2023-09-26 14:26:35 -07:00
|
|
|
#pragma once
|
2023-10-06 23:33:39 -07:00
|
|
|
#if INTELLISENSE_DIRECTIVES
|
2023-09-26 14:26:35 -07:00
|
|
|
#include "engine/engine.hpp"
|
2023-10-06 23:33:39 -07:00
|
|
|
#endif
|
2023-09-26 14:26:35 -07:00
|
|
|
|
2023-09-28 10:44:43 -07:00
|
|
|
#define NS_HANDMADE_BEGIN namespace hh {
|
2023-09-26 14:26:35 -07:00
|
|
|
#define NS_HANDMADE_END }
|
|
|
|
|
|
|
|
NS_HANDMADE_BEGIN
|
|
|
|
|
|
|
|
struct Memory
|
|
|
|
{
|
|
|
|
// Subscection of engine memory for the game to use.
|
|
|
|
|
2023-09-30 07:05:37 -07:00
|
|
|
void* persistent;
|
2023-10-11 14:52:13 -07:00
|
|
|
ssize persistent_size;
|
2023-09-26 14:26:35 -07:00
|
|
|
|
|
|
|
// void* Frame;
|
|
|
|
// u64 FrameSize;
|
|
|
|
|
2023-09-30 07:05:37 -07:00
|
|
|
void* transient;
|
2023-10-11 14:52:13 -07:00
|
|
|
ssize transient_size;
|
2023-09-30 07:05:37 -07:00
|
|
|
|
2023-10-11 14:52:13 -07:00
|
|
|
ssize total_size()
|
2023-09-30 07:05:37 -07:00
|
|
|
{
|
|
|
|
return persistent_size + transient_size;
|
|
|
|
}
|
2023-09-26 14:26:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
// We want a 'binding' to have multiple binds to active it (most likely)
|
|
|
|
struct Actionable
|
|
|
|
{
|
2023-09-30 07:05:37 -07:00
|
|
|
char const* name;
|
|
|
|
engine::InputBindCallback* binds;
|
|
|
|
s32 num_binds;
|
2023-09-26 14:26:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ActionableMode
|
|
|
|
{
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Platform Layer:
|
|
|
|
|
|
|
|
Controller : Keyboard & Mouse, XPad, DSPad
|
|
|
|
|
|
|
|
---VV---
|
|
|
|
|
|
|
|
Engine Layer:
|
|
|
|
|
|
|
|
InputBinding callbacks (per-game-logic frame basis)
|
|
|
|
Push/Pop input modes (binding sets)
|
|
|
|
|
|
|
|
---VV---
|
|
|
|
|
|
|
|
Game Layer:
|
|
|
|
|
|
|
|
Actionables : Binding Sets where a raw input, or input interpretation leads to an player action.
|
|
|
|
ActionSet : Actionables.Push/Pop -> Input.Push/Pop ?
|
|
|
|
Player : Controller, Actionables, ActionSets
|
|
|
|
*/
|
|
|
|
|
|
|
|
struct Player
|
|
|
|
{
|
|
|
|
// So far just has an assigned controller.
|
2023-09-30 07:05:37 -07:00
|
|
|
engine::ControllerState* controller;
|
2023-09-26 14:26:35 -07:00
|
|
|
|
|
|
|
// Possilby some other stuff in the future.
|
|
|
|
};
|
|
|
|
|
2023-09-28 10:44:43 -07:00
|
|
|
struct PlayerState
|
|
|
|
{
|
2023-10-04 10:55:15 -07:00
|
|
|
f32 width;
|
|
|
|
f32 height;
|
|
|
|
|
2023-10-11 14:52:13 -07:00
|
|
|
engine::TileMapPosition position;
|
|
|
|
|
2023-09-30 07:05:37 -07:00
|
|
|
b32 mid_jump;
|
|
|
|
f32 jump_time;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PlayerActions
|
|
|
|
{
|
|
|
|
s32 player_x_move_digital;
|
|
|
|
s32 player_y_move_digital;
|
|
|
|
f32 player_x_move_analog;
|
|
|
|
f32 player_y_move_analog;
|
2023-09-28 10:44:43 -07:00
|
|
|
|
2023-10-11 14:52:13 -07:00
|
|
|
b32 sprint;
|
|
|
|
b32 jump;
|
2023-09-28 10:44:43 -07:00
|
|
|
};
|
|
|
|
|
2023-10-06 10:06:40 -07:00
|
|
|
struct GameState
|
|
|
|
{
|
|
|
|
PlayerState player_state;
|
|
|
|
};
|
|
|
|
|
2023-09-26 14:26:35 -07:00
|
|
|
NS_HANDMADE_END
|
2023-10-06 23:33:39 -07:00
|
|
|
|