"Lost treasure of mBedungu" 100 level puzzle game for RETRO
Dependencies: LCD_ST7735 RetroPlatform mbed
Game/GameScreen.h@1:dcea5500a32d, 2015-03-01 (annotated)
- Committer:
- Architect
- Date:
- Sun Mar 01 05:32:06 2015 +0000
- Revision:
- 1:dcea5500a32d
- Parent:
- 0:f5f961973d01
Initial checkin
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Architect | 1:dcea5500a32d | 1 | /* |
Architect | 1:dcea5500a32d | 2 | * (C) Copyright 2015 Valentin Ivanov. All rights reserved. |
Architect | 1:dcea5500a32d | 3 | * |
Architect | 1:dcea5500a32d | 4 | * This file is part of the "Lost treasure of mBedungu" game application for Retro |
Architect | 1:dcea5500a32d | 5 | * |
Architect | 1:dcea5500a32d | 6 | * The "Lost treasure of mBedungu" application is free software: you can redistribute it and/or modify |
Architect | 1:dcea5500a32d | 7 | * it under the terms of the GNU Lesser General Public License as published by |
Architect | 1:dcea5500a32d | 8 | * the Free Software Foundation, either version 3 of the License, or |
Architect | 1:dcea5500a32d | 9 | * (at your option) any later version. |
Architect | 1:dcea5500a32d | 10 | * |
Architect | 1:dcea5500a32d | 11 | * This program is distributed in the hope that it will be useful, |
Architect | 1:dcea5500a32d | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Architect | 1:dcea5500a32d | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Architect | 1:dcea5500a32d | 14 | * GNU Lesser General Public License for more details. |
Architect | 1:dcea5500a32d | 15 | * |
Architect | 1:dcea5500a32d | 16 | * You should have received a copy of the GNU Lesser General Public License |
Architect | 1:dcea5500a32d | 17 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
Architect | 1:dcea5500a32d | 18 | * |
Architect | 1:dcea5500a32d | 19 | */ |
Architect | 1:dcea5500a32d | 20 | |
Architect | 0:f5f961973d01 | 21 | #ifndef __GAME_SCREEN_H__ |
Architect | 0:f5f961973d01 | 22 | #define __GAME_SCREEN_H__ |
Architect | 0:f5f961973d01 | 23 | |
Architect | 0:f5f961973d01 | 24 | #include "mbed.h" |
Architect | 0:f5f961973d01 | 25 | #include "ScreenBase.h" |
Architect | 0:f5f961973d01 | 26 | |
Architect | 0:f5f961973d01 | 27 | #define CELL_EMPTY 0 |
Architect | 0:f5f961973d01 | 28 | #define CELL_WALL 1 |
Architect | 0:f5f961973d01 | 29 | #define CELL_BARREL 2 |
Architect | 0:f5f961973d01 | 30 | #define CELL_LADDER 3 |
Architect | 0:f5f961973d01 | 31 | #define CELL_KEY 4 |
Architect | 0:f5f961973d01 | 32 | #define CELL_DOOR 5 |
Architect | 0:f5f961973d01 | 33 | #define CELL_LEFT 6 |
Architect | 0:f5f961973d01 | 34 | #define CELL_RIGHT 7 |
Architect | 0:f5f961973d01 | 35 | #define CELL_CRATE 8 |
Architect | 0:f5f961973d01 | 36 | #define CELL_TOTEM 9 |
Architect | 0:f5f961973d01 | 37 | #define CELL_RICK 10 |
Architect | 1:dcea5500a32d | 38 | #define CELL_TOP 11 |
Architect | 1:dcea5500a32d | 39 | #define CELL_HAPPY 12 |
Architect | 1:dcea5500a32d | 40 | |
Architect | 0:f5f961973d01 | 41 | |
Architect | 0:f5f961973d01 | 42 | |
Architect | 0:f5f961973d01 | 43 | class GameScreen : public ScreenBase |
Architect | 0:f5f961973d01 | 44 | { |
Architect | 0:f5f961973d01 | 45 | int _state; |
Architect | 0:f5f961973d01 | 46 | |
Architect | 0:f5f961973d01 | 47 | uint8_t _maze[64]; |
Architect | 0:f5f961973d01 | 48 | uint8_t _pocket[2]; |
Architect | 0:f5f961973d01 | 49 | |
Architect | 0:f5f961973d01 | 50 | uint8_t _rickX; |
Architect | 0:f5f961973d01 | 51 | uint8_t _rickY; |
Architect | 0:f5f961973d01 | 52 | |
Architect | 0:f5f961973d01 | 53 | uint8_t _totemX; |
Architect | 0:f5f961973d01 | 54 | uint8_t _totemY; |
Architect | 0:f5f961973d01 | 55 | uint8_t _level; |
Architect | 0:f5f961973d01 | 56 | uint8_t _rickDirection; |
Architect | 1:dcea5500a32d | 57 | |
Architect | 1:dcea5500a32d | 58 | bool _gameOver; |
Architect | 1:dcea5500a32d | 59 | bool _gameComplete; |
Architect | 1:dcea5500a32d | 60 | |
Architect | 1:dcea5500a32d | 61 | int frame; |
Architect | 1:dcea5500a32d | 62 | |
Architect | 1:dcea5500a32d | 63 | |
Architect | 1:dcea5500a32d | 64 | char _gameData[8]; |
Architect | 0:f5f961973d01 | 65 | public: |
Architect | 0:f5f961973d01 | 66 | GameScreen(); |
Architect | 0:f5f961973d01 | 67 | virtual Screen Update(); |
Architect | 0:f5f961973d01 | 68 | |
Architect | 0:f5f961973d01 | 69 | void unpackLevel( int level ); |
Architect | 0:f5f961973d01 | 70 | void resetLevel(); |
Architect | 1:dcea5500a32d | 71 | uint8_t getLevel(){ return _level; }; |
Architect | 0:f5f961973d01 | 72 | private: |
Architect | 0:f5f961973d01 | 73 | |
Architect | 0:f5f961973d01 | 74 | void next(); |
Architect | 0:f5f961973d01 | 75 | void moveleft(); |
Architect | 0:f5f961973d01 | 76 | void moveright(); |
Architect | 0:f5f961973d01 | 77 | void moveup(); |
Architect | 0:f5f961973d01 | 78 | void movedown(); |
Architect | 0:f5f961973d01 | 79 | |
Architect | 0:f5f961973d01 | 80 | bool moveto(uint8_t fromX, uint8_t fromY, uint8_t toX, uint8_t toY); |
Architect | 0:f5f961973d01 | 81 | bool fall(uint8_t fromX, uint8_t fromY); |
Architect | 0:f5f961973d01 | 82 | |
Architect | 0:f5f961973d01 | 83 | bool isPocketFull(); |
Architect | 0:f5f961973d01 | 84 | bool isPocketEmpty(); |
Architect | 0:f5f961973d01 | 85 | bool putInPocket( int item ); |
Architect | 0:f5f961973d01 | 86 | bool getKeyFromPocket(); |
Architect | 0:f5f961973d01 | 87 | bool getBarrelFromPocket(); |
Architect | 1:dcea5500a32d | 88 | |
Architect | 0:f5f961973d01 | 89 | void drawPocket(); |
Architect | 0:f5f961973d01 | 90 | void drawLevel(); |
Architect | 0:f5f961973d01 | 91 | }; |
Architect | 0:f5f961973d01 | 92 | |
Architect | 0:f5f961973d01 | 93 | #endif //__GAME_SCREEN_H_ |