Library containing the Game Engine

GameEngine.cpp

Committer:
ll14c4p
Date:
2017-05-02
Revision:
5:6224122fc07c
Parent:
4:e78f5bcddb01
Child:
6:c710fbc0f48e

File content as of revision 5:6224122fc07c:

#include "GameEngine.h"

GameEngine::GameEngine()
{

}

GameEngine::~GameEngine()
{

}

void GameEngine::init()
{
    
}



void GameEngine::read_input(Gamepad &pad)
{
    _d = pad.get_direction();
    _mag = pad.get_mag();
}

void GameEngine::draw(N5110 &lcd)
{
    // draw the elements in the LCD buffer
    // player
    _p.draw(lcd);
    _proj.draw(lcd);
}


void GameEngine::update(Gamepad &pad)
{
    _p.update(_d,_mag);
    _proj.update(); 

}

void GameEngine::get_pos()
{
    Vector2D player_pos = _p.get_pos();
    //printf("player pos = %f %f \n", player_pos.x, player_pos.y); //top left of player sprite
    // 81.000000 0.000000 top right
    // 0.000000 0.000000 is top left
    // 81.000000 45.000000 bottom right
    Vector2D proj_pos = _proj.get_pos();
    //printf("proj pos = %f %f \n", proj_pos.x, proj_pos.y);
    
    playerx = player_pos.x;
    playery = player_pos.y;
    printf("playerxy in GAME = %d %d \n", playerx, playery);
    _proj.init(playerx,playery);
    
    }