Library containing the Game Engine
GameEngine.cpp@0:5997fa876927, 2017-04-24 (annotated)
- Committer:
- ll14c4p
- Date:
- Mon Apr 24 11:06:49 2017 +0000
- Revision:
- 0:5997fa876927
- Child:
- 1:13a97de95e46
+ Game starts; + Models Render; + Working
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ll14c4p | 0:5997fa876927 | 1 | #include "GameEngine.h" |
ll14c4p | 0:5997fa876927 | 2 | |
ll14c4p | 0:5997fa876927 | 3 | GameEngine::GameEngine() |
ll14c4p | 0:5997fa876927 | 4 | { |
ll14c4p | 0:5997fa876927 | 5 | |
ll14c4p | 0:5997fa876927 | 6 | } |
ll14c4p | 0:5997fa876927 | 7 | |
ll14c4p | 0:5997fa876927 | 8 | GameEngine::~GameEngine() |
ll14c4p | 0:5997fa876927 | 9 | { |
ll14c4p | 0:5997fa876927 | 10 | |
ll14c4p | 0:5997fa876927 | 11 | } |
ll14c4p | 0:5997fa876927 | 12 | |
ll14c4p | 0:5997fa876927 | 13 | void GameEngine::init() |
ll14c4p | 0:5997fa876927 | 14 | { |
ll14c4p | 0:5997fa876927 | 15 | |
ll14c4p | 0:5997fa876927 | 16 | } |
ll14c4p | 0:5997fa876927 | 17 | |
ll14c4p | 0:5997fa876927 | 18 | |
ll14c4p | 0:5997fa876927 | 19 | |
ll14c4p | 0:5997fa876927 | 20 | void GameEngine::read_input(Gamepad &pad) |
ll14c4p | 0:5997fa876927 | 21 | { |
ll14c4p | 0:5997fa876927 | 22 | _d = pad.get_direction(); |
ll14c4p | 0:5997fa876927 | 23 | _mag = pad.get_mag(); |
ll14c4p | 0:5997fa876927 | 24 | } |
ll14c4p | 0:5997fa876927 | 25 | |
ll14c4p | 0:5997fa876927 | 26 | void GameEngine::draw(N5110 &lcd) |
ll14c4p | 0:5997fa876927 | 27 | { |
ll14c4p | 0:5997fa876927 | 28 | // draw the elements in the LCD buffer |
ll14c4p | 0:5997fa876927 | 29 | // player |
ll14c4p | 0:5997fa876927 | 30 | _p.draw(lcd); |
ll14c4p | 0:5997fa876927 | 31 | } |
ll14c4p | 0:5997fa876927 | 32 | |
ll14c4p | 0:5997fa876927 | 33 | void GameEngine::update(Gamepad &pad) |
ll14c4p | 0:5997fa876927 | 34 | { |
ll14c4p | 0:5997fa876927 | 35 | // important to update paddles and ball before checking collisions so can |
ll14c4p | 0:5997fa876927 | 36 | // correct for it before updating the display |
ll14c4p | 0:5997fa876927 | 37 | _p.update(_d,_mag); |
ll14c4p | 0:5997fa876927 | 38 | |
ll14c4p | 0:5997fa876927 | 39 | } |