power_play/src/window/window.h
2026-03-10 18:03:06 -05:00

99 lines
2.1 KiB
C

////////////////////////////////////////////////////////////
//~ Handle types
Struct(WND_Handle)
{
u64 v;
};
////////////////////////////////////////////////////////////
//~ Cursor types
Enum(WND_CursorKind)
{
WND_CursorKind_Default,
WND_CursorKind_Hidden,
WND_CursorKind_Text,
WND_CursorKind_No,
WND_CursorKind_Hand,
WND_CursorKind_Move,
WND_CursorKind_HorizontalResize,
WND_CursorKind_VerticalResize,
WND_CursorKind_TlBrResize,
WND_CursorKind_TrBlResize,
WND_CursorKind_COUNT
};
////////////////////////////////////////////////////////////
//~ Cmd types
Enum(WND_CmdKind)
{
WND_CmdKind_None,
WND_CmdKind_SetMinimized,
WND_CmdKind_SetMaximized,
WND_CmdKind_SetFullscreen,
WND_CmdKind_SetForcedTop,
WND_CmdKind_SetCursor,
WND_CmdKind_SetCursorPos,
WND_CmdKind_SetLockedCursor,
WND_CmdKind_Restore,
};
Struct(WND_Cmd)
{
WND_CmdKind kind;
WND_CursorKind cursor;
String restore;
b32 v;
Vec2 pos;
};
////////////////////////////////////////////////////////////
//~ Frame types
Enum(WND_BackbufferSizeMode)
{
WND_BackbufferSizeMode_MatchWindow,
WND_BackbufferSizeMode_MatchMonitor,
};
Struct(WND_Frame)
{
WND_Handle window;
G_BackbufferHandle backbuffer;
ControllerEventsArray controller_events;
Vec2I32 draw_size;
Vec2I32 monitor_size;
String restore;
b32 minimized;
b32 maximized;
b32 fullscreen;
b32 forced_top;
b32 has_focus;
};
////////////////////////////////////////////////////////////
//~ @hookdecl Bootstrap
void WND_Bootstrap(void);
////////////////////////////////////////////////////////////
//~ @hookdecl Command
#define WND_PushCmd(frame, ...) WND_PushCmd_((frame), (WND_Cmd) { __VA_ARGS__ })
void WND_PushCmd_(WND_Frame frame, WND_Cmd desc);
//- Command helpers
#define WND_SetCursor(_frame, _cursor) WND_PushCmd((_frame), .kind = WND_CmdKind_SetCursor, .cursor = (_cursor))
////////////////////////////////////////////////////////////
//~ @hookdecl Frame
WND_Frame WND_BeginFrame(G_Format backbuffer_format, WND_BackbufferSizeMode backbuffer_size_mode);
void WND_EndFrame(WND_Frame frame, Vec2I32 backbuffer_pos, G_TextureRef src, Rng2I32 src_range, i32 vsync);