HandmadeHero/project/handmade.hpp

103 lines
1.6 KiB
C++
Raw Normal View History

2023-09-26 14:26:35 -07:00
#pragma once
#include "engine/engine.hpp"
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.
void* persistent;
u64 persistent_size;
2023-09-26 14:26:35 -07:00
// void* Frame;
// u64 FrameSize;
void* transient;
u64 transient_size;
u64 total_size()
{
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
{
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.
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-06 10:06:40 -07:00
// TODO(Ed) : Should this be canonical position now?
2023-10-01 17:17:14 -07:00
f32 pos_x;
f32 pos_y;
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
b32 jump = false;
2023-09-28 10:44:43 -07:00
};
2023-10-06 10:06:40 -07:00
struct GameState
{
s32 tile_map_x;
s32 tile_map_y;
PlayerState player_state;
};
2023-09-26 14:26:35 -07:00
NS_HANDMADE_END