Revert "Death to C++"

This reverts commit 066ac22605.
This commit is contained in:
2026-03-11 19:15:36 -04:00
parent 066ac22605
commit 13f856cfbc
80 changed files with 39269 additions and 5672 deletions

View File

@@ -31,7 +31,7 @@ enum {
PKEY_MINUS = 0xBD, // '-'/'_' (VK_OEM_MINUS)
};
typedef struct PlatformInput {
struct PlatformInput {
// Typed characters (UTF-16 code units, printable only)
U16 chars[PLATFORM_MAX_CHARS_PER_FRAME];
S32 char_count;
@@ -49,50 +49,41 @@ typedef struct PlatformInput {
Vec2F32 scroll_delta;
B32 mouse_down;
B32 was_mouse_down;
} PlatformInput;
};
typedef struct PlatformWindow PlatformWindow;
struct PlatformWindow;
typedef enum PlatformWindowStyle {
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;
};
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;
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)
};
// 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 {
enum PlatformMsgBoxType {
PLATFORM_MSGBOX_OK = 0,
PLATFORM_MSGBOX_OK_CANCEL = 1,
PLATFORM_MSGBOX_YES_NO = 2,
} PlatformMsgBoxType;
};
typedef struct PlatformMenuItem {
const char *label; // NULL = separator
struct PlatformMenuItem {
const char *label; // nullptr = separator
S32 id; // command ID (ignored for separators)
} PlatformMenuItem;
};
typedef struct PlatformMenu {
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
@@ -123,11 +114,11 @@ S32 platform_message_box(PlatformWindow *parent, const char *title,
const char *message, PlatformMsgBoxType type);
// Cursor shapes for resize handles
typedef enum PlatformCursor {
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);
@@ -137,6 +128,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 NULL.
// platform_clipboard_get returns a pointer to a static buffer (valid until next call), or nullptr.
void platform_clipboard_set(const char *text);
const char *platform_clipboard_get(void);
const char *platform_clipboard_get();