2023-01-07 02:54:18 +00:00
|
|
|
#ifndef LD52_HARVEST_FOOD_CUTS_GAME_H_
|
|
|
|
#define LD52_HARVEST_FOOD_CUTS_GAME_H_
|
|
|
|
|
2023-01-07 05:36:14 +00:00
|
|
|
// standard library includes
|
|
|
|
#include <bitset>
|
|
|
|
#include <random>
|
|
|
|
|
|
|
|
// third party includes
|
|
|
|
#include <raylib.h>
|
|
|
|
|
2023-01-07 02:54:18 +00:00
|
|
|
class Game {
|
|
|
|
public:
|
|
|
|
Game();
|
|
|
|
|
|
|
|
void do_update();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void update_impl();
|
|
|
|
void draw_impl();
|
|
|
|
|
2023-01-07 07:01:46 +00:00
|
|
|
void reset(bool wasGameOver);
|
2023-01-07 05:36:14 +00:00
|
|
|
|
|
|
|
std::default_random_engine re;
|
|
|
|
std::uniform_int_distribution<unsigned int> dist;
|
|
|
|
std::string scoreString;
|
2023-01-07 07:35:29 +00:00
|
|
|
std::string highScoreString;
|
2023-01-07 05:36:14 +00:00
|
|
|
Texture2D spriteSheet;
|
|
|
|
unsigned long long score;
|
2023-01-07 07:35:29 +00:00
|
|
|
unsigned long long highScore;
|
2023-01-07 05:36:14 +00:00
|
|
|
/*
|
|
|
|
* 0 - score dirty
|
|
|
|
* 1 - is blinking
|
|
|
|
* 2 - happy
|
2023-01-07 07:01:46 +00:00
|
|
|
* 3 - fruit dirty
|
|
|
|
* 4 - cut has happened
|
|
|
|
* 5 - sad
|
|
|
|
* 6 - relativeCutPos is set
|
2023-01-07 05:36:14 +00:00
|
|
|
*/
|
|
|
|
std::bitset<32> flags;
|
|
|
|
float areaSizeRatio;
|
|
|
|
float currentArea;
|
|
|
|
unsigned int currentFood;
|
|
|
|
float blinkTimer;
|
|
|
|
float cutTimer;
|
|
|
|
float cutTimerRateInc;
|
2023-01-07 07:01:46 +00:00
|
|
|
float ratio;
|
|
|
|
float width;
|
|
|
|
float height;
|
|
|
|
float offsetX;
|
|
|
|
float offsetY;
|
|
|
|
float cutPos;
|
|
|
|
float relativeCutRatio;
|
|
|
|
float splitX;
|
|
|
|
float splitY;
|
|
|
|
float splitAngle;
|
|
|
|
float splitDX;
|
|
|
|
float splitDY;
|
|
|
|
float splitDAngle;
|
|
|
|
float postCutTimer;
|
2023-01-07 02:54:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|