Format all

This commit is contained in:
2026-03-12 10:41:16 -04:00
parent 13f856cfbc
commit c7bb89fd6d
31 changed files with 3289 additions and 3200 deletions

View File

@@ -27,45 +27,45 @@ enum {
PKEY_V = 0x56,
PKEY_X = 0x58,
PKEY_0 = 0x30,
PKEY_EQUAL = 0xBB, // '='/'+' (VK_OEM_PLUS)
PKEY_MINUS = 0xBD, // '-'/'_' (VK_OEM_MINUS)
PKEY_EQUAL = 0xBB, // '='/'+' (VK_OEM_PLUS)
PKEY_MINUS = 0xBD, // '-'/'_' (VK_OEM_MINUS)
};
struct PlatformInput {
// Typed characters (UTF-16 code units, printable only)
U16 chars[PLATFORM_MAX_CHARS_PER_FRAME];
S32 char_count;
S32 char_count;
// Key-down events (virtual key codes)
U8 keys[PLATFORM_MAX_KEYS_PER_FRAME];
S32 key_count;
S32 key_count;
// Modifier state at time of last key event
B32 ctrl_held;
B32 shift_held;
B32 ctrl_held;
B32 shift_held;
// Mouse state (polled per frame)
Vec2F32 mouse_pos;
Vec2F32 scroll_delta;
B32 mouse_down;
B32 was_mouse_down;
Vec2F32 mouse_pos;
Vec2F32 scroll_delta;
B32 mouse_down;
B32 was_mouse_down;
};
struct PlatformWindow;
enum PlatformWindowStyle {
PLATFORM_WINDOW_STYLE_NORMAL = 0,
PLATFORM_WINDOW_STYLE_POPUP = 1, // utility panel, owned by parent, fixed size
PLATFORM_WINDOW_STYLE_POPUP_RESIZABLE = 2, // utility panel, owned by parent, resizable
PLATFORM_WINDOW_STYLE_NORMAL = 0,
PLATFORM_WINDOW_STYLE_POPUP = 1, // utility panel, owned by parent, fixed size
PLATFORM_WINDOW_STYLE_POPUP_RESIZABLE = 2, // utility panel, owned by parent, resizable
};
struct PlatformWindowDesc {
const char *title = "autosample";
S32 width = 1280;
S32 height = 720;
PlatformWindowStyle style = PLATFORM_WINDOW_STYLE_NORMAL;
PlatformWindow *parent = nullptr;
B32 independent = 0; // if true, don't attach as child (independent top-level window)
const char *title = "autosample";
S32 width = 1280;
S32 height = 720;
PlatformWindowStyle style = PLATFORM_WINDOW_STYLE_NORMAL;
PlatformWindow *parent = nullptr;
B32 independent = 0; // if true, don't attach as child (independent top-level window)
};
enum PlatformMsgBoxType {
@@ -75,14 +75,14 @@ enum PlatformMsgBoxType {
};
struct PlatformMenuItem {
const char *label; // nullptr = separator
S32 id; // command ID (ignored for separators)
const char *label; // nullptr = separator
S32 id; // command ID (ignored for separators)
};
struct PlatformMenu {
const char *label;
PlatformMenuItem *items;
S32 item_count;
const char *label;
PlatformMenuItem *items;
S32 item_count;
};
// Called by the platform layer when the window needs a frame rendered
@@ -92,13 +92,13 @@ typedef void (*PlatformFrameCallback)(void *user_data);
PlatformWindow *platform_create_window(PlatformWindowDesc *desc);
void platform_destroy_window(PlatformWindow *window);
B32 platform_poll_events(PlatformWindow *window);
B32 platform_poll_events(PlatformWindow *window);
void platform_get_size(PlatformWindow *window, S32 *w, S32 *h);
void *platform_get_native_handle(PlatformWindow *window);
void platform_set_frame_callback(PlatformWindow *window, PlatformFrameCallback cb, void *user_data);
void platform_set_menu(PlatformWindow *window, PlatformMenu *menus, S32 menu_count);
S32 platform_poll_menu_command(PlatformWindow *window);
void platform_set_frame_callback(PlatformWindow *window, PlatformFrameCallback cb, void *user_data);
void platform_set_menu(PlatformWindow *window, PlatformMenu *menus, S32 menu_count);
S32 platform_poll_menu_command(PlatformWindow *window);
// Returns accumulated input since last call (keyboard events + polled mouse state), then clears the buffer.
PlatformInput platform_get_input(PlatformWindow *window);
@@ -116,8 +116,8 @@ S32 platform_message_box(PlatformWindow *parent, const char *title,
// Cursor shapes for resize handles
enum PlatformCursor {
PLATFORM_CURSOR_ARROW = 0,
PLATFORM_CURSOR_SIZE_WE = 1, // horizontal resize
PLATFORM_CURSOR_SIZE_NS = 2, // vertical resize
PLATFORM_CURSOR_SIZE_WE = 1, // horizontal resize
PLATFORM_CURSOR_SIZE_NS = 2, // vertical resize
};
void platform_set_cursor(PlatformCursor cursor);