75 lines
1.3 KiB
C++
75 lines
1.3 KiB
C++
#pragma once
|
|
#include "raylib.h"
|
|
#include "lib.h"
|
|
#include "sprites.h"
|
|
|
|
#include <optional>
|
|
|
|
using namespace std;
|
|
|
|
#define TEXTURES_BUF_SIZE 16
|
|
#define TARGET_FPS 60
|
|
#define MAX_KNIGHTS 50
|
|
#define SCREEN_WIDTH 1300
|
|
#define SCREEN_HEIGHT 1080
|
|
|
|
#define DEBUG_MODE_ENABLED
|
|
|
|
bool global_debug_mode = false;
|
|
|
|
enum class KnightState : u8 {
|
|
IDLE = 0,
|
|
RUNNING = 1,
|
|
ATTACKING = 2,
|
|
};
|
|
|
|
enum class Direction : u8 {
|
|
UP = 0,
|
|
DOWN = 1,
|
|
LEFT = 2,
|
|
RIGHT = 3,
|
|
// DIR_UP_LEFT = 4,
|
|
// DIR_UP_RIGHT = 5,
|
|
// DIR_DOWN_LEFT = 6,
|
|
// DIR_DOWN_RIGHT = 7,
|
|
};
|
|
|
|
struct Knight {
|
|
Point position;
|
|
Point move_target_point;
|
|
Direction look_dir;
|
|
KnightState state;
|
|
u8 selected;
|
|
u8 ordered_to_move;
|
|
};
|
|
|
|
struct Assets {
|
|
Texture2D *textures;
|
|
};
|
|
|
|
struct GameState {
|
|
Camera2D camera;
|
|
int frame_count;
|
|
Point camera_position;
|
|
|
|
optional<Point> selected_point;
|
|
Knight *knights;
|
|
SpriteAnimationPlayback *anim_playbacks;
|
|
Knight *selected_knights;
|
|
|
|
optional<Point> selection_mouse_start_pos;
|
|
|
|
int entity_count;
|
|
Assets assets;
|
|
|
|
~GameState() {
|
|
free(knights);
|
|
free(anim_playbacks);
|
|
for (int i = 0; i < TEXTURES_BUF_SIZE; i++) {
|
|
UnloadTexture(assets.textures[i]);
|
|
}
|
|
free(assets.textures);
|
|
printf("I freed the stuff?\n");
|
|
}
|
|
};
|