diff options
| author | XaviDCR92 <xavi.dcr@gmail.com> | 2017-09-08 18:39:22 +0200 |
|---|---|---|
| committer | XaviDCR92 <xavi.dcr@gmail.com> | 2017-09-08 18:39:22 +0200 |
| commit | 786dccd2bc0946d48b8a2758ef2c607678bc8dd9 (patch) | |
| tree | 47952d77e5646a993671134b50c16f32ebe35b1c /Player.h | |
| parent | 72d350a37aa67936361ac8a374472b7e0227da61 (diff) | |
| download | pocketempires-786dccd2bc0946d48b8a2758ef2c607678bc8dd9.tar.gz | |
Removed Building and GameStructures modules. Restructured SW for Unit and Player, still a lot TODO
Diffstat (limited to 'Player.h')
| -rw-r--r-- | Player.h | 82 |
1 files changed, 52 insertions, 30 deletions
@@ -4,29 +4,35 @@ /* ************************************** * Includes * * **************************************/ - + #include "Global_Inc.h" -#include "GameStructures.h" #include "Camera.h" -#include "Building.h" #include "Unit.h" - + /* ************************************** * Defines * * **************************************/ - + #define PLAYER_NAME_LENGTH 16 -#define PLAYER_MAX_UNITS 32 -#define PLAYER_MAX_BUILDINGS 32 +#define PLAYER_MAX_UNITS_BUILDINGS 32 /* ************************************** * Structs and enums * * **************************************/ - + +typedef struct t_Resource +{ + uint8_t Wood; + uint8_t Gold; + uint8_t Food; +}TYPE_RESOURCES; + /* ************************************** * Class definition * * **************************************/ - + +#ifdef __cplusplus + class Player { public: @@ -35,36 +41,52 @@ class Player void Init(void); void Handler(void); void DrawHandler(void); - char * getName(void) {return name;} + char* getName(void) {return name;} void setHuman(bool value) { human = value; } bool isHuman(void) {return human;} - bool createUnit(uint8_t id, TYPE_COLLISION_BLOCK cb); - bool createBuilding(TYPE_BUILDING_ID id, TYPE_COLLISION_BLOCK cb); + bool createUnit(TYPE_UNIT_ID id, TYPE_COLLISION_BLOCK cb); uint8_t getPopulation(void) {return (unit_i + 1);} - uint8_t getBuildings(void) {return (bldg_i + 1);} - + private: + // Player definition + bool human; + char name[PLAYER_NAME_LENGTH]; + TYPE_RESOURCES Resources; + + // Unit handling + TYPE_UNIT units[PLAYER_MAX_UNITS_BUILDINGS]; + uint8_t unit_i; + + // Camera handling + TYPE_CAMERA Camera; + + // Button pressed/released events + void ButtonLeftReleased(void); + void ButtonRightReleased(void); + void ButtonAPressed(void); + void ButtonAReleased(void); + void ButtonBPressed(void); + void ButtonBReleased(void); + bool checkNewBuildingPosition(TYPE_COLLISION_BLOCK * cb); void UnitBuildingSelection(void); void showHealth(uint8_t hp); void ButtonHandler(void); - void BuildingUnitActions(void); + void ActionsMenu(void); TYPE_COLLISION_BLOCK GetCursorPos(void); - - char name[PLAYER_NAME_LENGTH]; - TYPE_UNIT units[PLAYER_MAX_UNITS]; - TYPE_BUILDING buildings[PLAYER_MAX_BUILDINGS]; - TYPE_UNIT* selectedUnit; - TYPE_BUILDING* selectedBuilding; - uint8_t id; - uint8_t unit_i; - uint8_t bldg_i; - bool human; - bool showUnitBuildingOptions; - TYPE_CAMERA Camera; - TYPE_RESOURCES Resources; - uint8_t progress_bar; - //Print _serial; + + // Unit selection + bool anyUnitSelected; + int8_t selectedUnitCandidate; + uint8_t unselectUnits_counter; + + // Actions selection + bool showActionsMenu; + uint8_t showActionsMenu_counter; + uint8_t showActionsMenu_index; + void IncreaseShowActionsMenuIndex(); }; +#endif // __cplusplus + #endif //PLAYER_HEADER__ |
