Library containing the Game Engine

GameEngine.cpp

Committer:
ll14c4p
Date:
2017-05-02
Revision:
4:e78f5bcddb01
Parent:
3:2f8f003ce4fd
Child:
5:6224122fc07c

File content as of revision 4:e78f5bcddb01:

#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)
{
    // important to update paddles and ball before checking collisions so can
    // correct for it before updating the display
    _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);
    
    }