fix ui widgets
This commit is contained in:
@@ -3,6 +3,46 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
////////////////////////////////
|
||||
// Input event buffer
|
||||
// Accumulated per frame, consumed by the app each tick.
|
||||
|
||||
#define PLATFORM_MAX_CHARS_PER_FRAME 64
|
||||
#define PLATFORM_MAX_KEYS_PER_FRAME 32
|
||||
|
||||
// Virtual key codes (subset matching Win32 VK_ codes)
|
||||
enum {
|
||||
PKEY_BACKSPACE = 0x08,
|
||||
PKEY_TAB = 0x09,
|
||||
PKEY_RETURN = 0x0D,
|
||||
PKEY_ESCAPE = 0x1B,
|
||||
PKEY_DELETE = 0x2E,
|
||||
PKEY_LEFT = 0x25,
|
||||
PKEY_UP = 0x26,
|
||||
PKEY_RIGHT = 0x27,
|
||||
PKEY_DOWN = 0x28,
|
||||
PKEY_HOME = 0x24,
|
||||
PKEY_END = 0x23,
|
||||
PKEY_A = 0x41,
|
||||
PKEY_C = 0x43,
|
||||
PKEY_V = 0x56,
|
||||
PKEY_X = 0x58,
|
||||
};
|
||||
|
||||
struct PlatformInputEvents {
|
||||
// Typed characters (UTF-16 code units, printable only)
|
||||
uint16_t chars[PLATFORM_MAX_CHARS_PER_FRAME];
|
||||
int32_t char_count;
|
||||
|
||||
// Key-down events (virtual key codes)
|
||||
uint8_t keys[PLATFORM_MAX_KEYS_PER_FRAME];
|
||||
int32_t key_count;
|
||||
|
||||
// Modifier state at time of last key event
|
||||
bool ctrl_held;
|
||||
bool shift_held;
|
||||
};
|
||||
|
||||
struct PlatformWindow;
|
||||
|
||||
struct PlatformWindowDesc {
|
||||
@@ -36,3 +76,6 @@ 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, int32_t menu_count);
|
||||
int32_t platform_poll_menu_command(PlatformWindow *window);
|
||||
|
||||
// Returns accumulated input events since last call, then clears the buffer.
|
||||
PlatformInputEvents platform_get_input_events(PlatformWindow *window);
|
||||
|
||||
Reference in New Issue
Block a user