feat: add engine SaveStorageData and LoadStorageData and started saving stats of player

This commit is contained in:
2026-03-08 15:25:20 +01:00
parent 40d48b4f2f
commit 341b675fa9
6 changed files with 90 additions and 2 deletions
+8
View File
@@ -8,6 +8,7 @@
// DEFINES//
#define TEXT_COLOR_DARK (Color){182, 137, 98, 255}
#define TEXT_COLOR_LIGHT (Color){243, 229, 194, 255}
#define STORAGE_DATA_FILE "save1.data"
// ENUMS//
typedef enum {
@@ -38,6 +39,12 @@ typedef enum { GAMEPLAY_THEME, AMBIENT, SOUNDTRACK_COUNT } SoundtrackID;
typedef enum View { LOGO = 0, MENU = 1, GAMEPLAY = 2 } View;
typedef enum {
STORAGE_POSITION_GOLD = 0,
STORAGE_POSITION_POSX = 1,
STORAGE_POSITION_POSY = 2
} StorageData;
// STRUCTS//
typedef struct {
int frameCounter;
@@ -101,6 +108,7 @@ typedef struct {
Physics physics;
float rotation;
Sound soundFlapping;
int gold;
} Player;
typedef enum { BOAT, ENEMIES_TEX_COUNT } enemiesTextureID;
+3
View File
@@ -237,5 +237,8 @@ float Vector2ToRotation(Vector2 vec);
Vector2 GetPositionInsideRectangle(Rectangle rec);
Vector2 GetPositionOutsideRectangle(Rectangle rec, int min, int max);
bool SaveStorageValue(const char* fileName, unsigned int position, int value);
int LoadStorageValue(const char* fileName, unsigned int position);
#endif //ENGINE_H