Library containing the Game Engine

GameEngine.cpp

Committer:
ll14c4p
Date:
2017-04-29
Revision:
3:2f8f003ce4fd
Parent:
2:3b1d8ac1aac1
Child:
4:e78f5bcddb01

File content as of revision 3:2f8f003ce4fd:

#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("yolo swag %f %f \n", player_pos.x, player_pos.y); //top left of player sprite
    //yolo swag 81.000000 0.000000 top right
    //yolo swag 0.000000 0.000000 is top left
    //yolo swag 81.000000 45.000000 bottom right
    
    }