Death to C++

This commit is contained in:
2026-03-09 16:17:05 -04:00
parent b074d2113f
commit 066ac22605
80 changed files with 5671 additions and 39268 deletions

View File

@@ -31,7 +31,7 @@ enum {
PKEY_MINUS = 0xBD, // '-'/'_' (VK_OEM_MINUS)
};
struct PlatformInput {
typedef struct PlatformInput {
// Typed characters (UTF-16 code units, printable only)
U16 chars[PLATFORM_MAX_CHARS_PER_FRAME];
S32 char_count;
@@ -49,41 +49,50 @@ struct PlatformInput {
Vec2F32 scroll_delta;
B32 mouse_down;
B32 was_mouse_down;
};
} PlatformInput;
struct PlatformWindow;
typedef struct PlatformWindow PlatformWindow;
enum PlatformWindowStyle {
typedef 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
};
} PlatformWindowStyle;
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)
};
typedef struct PlatformWindowDesc {
const char *title;
S32 width;
S32 height;
PlatformWindowStyle style;
PlatformWindow *parent;
B32 independent; // if true, don't attach as child (independent top-level window)
} PlatformWindowDesc;
enum PlatformMsgBoxType {
// Helper to create a default PlatformWindowDesc
static inline PlatformWindowDesc platform_window_desc_default(void) {
PlatformWindowDesc d = {0};
d.title = "autosample";
d.width = 1280;
d.height = 720;
return d;
}
typedef enum PlatformMsgBoxType {
PLATFORM_MSGBOX_OK = 0,
PLATFORM_MSGBOX_OK_CANCEL = 1,
PLATFORM_MSGBOX_YES_NO = 2,
};
} PlatformMsgBoxType;
struct PlatformMenuItem {
const char *label; // nullptr = separator
typedef struct PlatformMenuItem {
const char *label; // NULL = separator
S32 id; // command ID (ignored for separators)
};
} PlatformMenuItem;
struct PlatformMenu {
typedef struct PlatformMenu {
const char *label;
PlatformMenuItem *items;
S32 item_count;
};
} PlatformMenu;
// Called by the platform layer when the window needs a frame rendered
// (e.g., during a live resize). user_data is the pointer passed to
@@ -114,11 +123,11 @@ S32 platform_message_box(PlatformWindow *parent, const char *title,
const char *message, PlatformMsgBoxType type);
// Cursor shapes for resize handles
enum PlatformCursor {
typedef enum PlatformCursor {
PLATFORM_CURSOR_ARROW = 0,
PLATFORM_CURSOR_SIZE_WE = 1, // horizontal resize
PLATFORM_CURSOR_SIZE_NS = 2, // vertical resize
};
} PlatformCursor;
void platform_set_cursor(PlatformCursor cursor);
@@ -128,6 +137,6 @@ F32 platform_get_dpi_scale(PlatformWindow *window);
// Clipboard operations (null-terminated UTF-8 strings).
// platform_clipboard_set copies text to the system clipboard.
// platform_clipboard_get returns a pointer to a static buffer (valid until next call), or nullptr.
// platform_clipboard_get returns a pointer to a static buffer (valid until next call), or NULL.
void platform_clipboard_set(const char *text);
const char *platform_clipboard_get();
const char *platform_clipboard_get(void);