mirror of
https://github.com/Ed94/raddebugger.git
synced 2026-08-05 13:28:40 +00:00
simplification pass over os core layer; simplification pass over base arena; set up build.sh; stub out new spot for linux os core
This commit is contained in:
+191
-182
@@ -1,182 +1,191 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef OS_GRAPHICAL_H
|
||||
#define OS_GRAPHICAL_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Window Types
|
||||
|
||||
typedef U32 OS_WindowFlags;
|
||||
enum
|
||||
{
|
||||
OS_WindowFlag_CustomBorder = (1<<0),
|
||||
};
|
||||
|
||||
typedef void OS_WindowRepaintFunctionType(OS_Handle window, void *user_data);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cursor Types
|
||||
|
||||
typedef enum OS_Cursor
|
||||
{
|
||||
OS_Cursor_Pointer,
|
||||
OS_Cursor_IBar,
|
||||
OS_Cursor_LeftRight,
|
||||
OS_Cursor_UpDown,
|
||||
OS_Cursor_DownRight,
|
||||
OS_Cursor_UpRight,
|
||||
OS_Cursor_UpDownLeftRight,
|
||||
OS_Cursor_HandPoint,
|
||||
OS_Cursor_Disabled,
|
||||
OS_Cursor_COUNT,
|
||||
}
|
||||
OS_Cursor;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
|
||||
#include "os/gfx/generated/os_gfx.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Types
|
||||
|
||||
typedef enum OS_EventKind
|
||||
{
|
||||
OS_EventKind_Null,
|
||||
OS_EventKind_Press,
|
||||
OS_EventKind_Release,
|
||||
OS_EventKind_MouseMove,
|
||||
OS_EventKind_Text,
|
||||
OS_EventKind_Scroll,
|
||||
OS_EventKind_WindowLoseFocus,
|
||||
OS_EventKind_WindowClose,
|
||||
OS_EventKind_FileDrop,
|
||||
OS_EventKind_Wakeup,
|
||||
OS_EventKind_COUNT
|
||||
}
|
||||
OS_EventKind;
|
||||
|
||||
typedef U32 OS_EventFlags;
|
||||
enum
|
||||
{
|
||||
OS_EventFlag_Ctrl = (1<<0),
|
||||
OS_EventFlag_Shift = (1<<1),
|
||||
OS_EventFlag_Alt = (1<<2),
|
||||
};
|
||||
|
||||
typedef struct OS_Event OS_Event;
|
||||
struct OS_Event
|
||||
{
|
||||
OS_Event *next;
|
||||
OS_Event *prev;
|
||||
U64 timestamp_us;
|
||||
OS_Handle window;
|
||||
OS_EventKind kind;
|
||||
OS_EventFlags flags;
|
||||
OS_Key key;
|
||||
B32 is_repeat;
|
||||
B32 right_sided;
|
||||
U32 character;
|
||||
U32 repeat_count;
|
||||
Vec2F32 pos;
|
||||
Vec2F32 delta;
|
||||
String8List strings;
|
||||
};
|
||||
|
||||
typedef struct OS_EventList OS_EventList;
|
||||
struct OS_EventList
|
||||
{
|
||||
U64 count;
|
||||
OS_Event *first;
|
||||
OS_Event *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Functions (Helpers, Implemented Once)
|
||||
|
||||
internal String8List os_string_list_from_event_flags(Arena *arena, OS_EventFlags flags);
|
||||
internal U32 os_codepoint_from_event_flags_and_key(OS_EventFlags flags, OS_Key key);
|
||||
internal void os_eat_event(OS_EventList *events, OS_Event *event);
|
||||
internal B32 os_key_press(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
|
||||
internal B32 os_key_release(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
|
||||
internal B32 os_text(OS_EventList *events, OS_Handle window, U32 character);
|
||||
internal OS_EventList os_event_list_copy(Arena *arena, OS_EventList *src);
|
||||
internal void os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void os_graphical_init(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void os_set_clipboard_text(String8 string);
|
||||
internal String8 os_get_clipboard_text(Arena *arena);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title);
|
||||
internal void os_window_close(OS_Handle window);
|
||||
internal void os_window_first_paint(OS_Handle window);
|
||||
internal void os_window_equip_repaint(OS_Handle window, OS_WindowRepaintFunctionType *repaint, void *user_data);
|
||||
internal void os_window_focus(OS_Handle window);
|
||||
internal B32 os_window_is_focused(OS_Handle window);
|
||||
internal B32 os_window_is_fullscreen(OS_Handle window);
|
||||
internal void os_window_set_fullscreen(OS_Handle window, B32 fullscreen);
|
||||
internal B32 os_window_is_maximized(OS_Handle window);
|
||||
internal void os_window_set_maximized(OS_Handle window, B32 maximized);
|
||||
internal void os_window_minimize(OS_Handle window);
|
||||
internal void os_window_bring_to_front(OS_Handle window);
|
||||
internal void os_window_set_monitor(OS_Handle window, OS_Handle monitor);
|
||||
internal void os_window_clear_custom_border_data(OS_Handle handle);
|
||||
internal void os_window_push_custom_title_bar(OS_Handle handle, F32 thickness);
|
||||
internal void os_window_push_custom_edges(OS_Handle handle, F32 thickness);
|
||||
internal void os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect);
|
||||
internal Rng2F32 os_rect_from_window(OS_Handle window);
|
||||
internal Rng2F32 os_client_rect_from_window(OS_Handle window);
|
||||
internal F32 os_dpi_from_window(OS_Handle window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_HandleArray os_push_monitors_array(Arena *arena);
|
||||
internal OS_Handle os_primary_monitor(void);
|
||||
internal OS_Handle os_monitor_from_window(OS_Handle window);
|
||||
internal String8 os_name_from_monitor(Arena *arena, OS_Handle monitor);
|
||||
internal Vec2F32 os_dim_from_monitor(OS_Handle monitor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
internal void os_send_wakeup_event(void);
|
||||
internal OS_EventList os_get_events(Arena *arena, B32 wait);
|
||||
internal OS_EventFlags os_get_event_flags(void);
|
||||
internal B32 os_key_is_down(OS_Key key);
|
||||
internal Vec2F32 os_mouse_from_window(OS_Handle window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void os_set_cursor(OS_Cursor cursor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks System Properties (Implemented Per-OS)
|
||||
|
||||
internal F32 os_double_click_time(void);
|
||||
internal F32 os_caret_blink_time(void);
|
||||
internal F32 os_default_refresh_rate(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void os_graphical_message(B32 error, String8 title, String8 message);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void os_show_in_filesystem_ui(String8 path);
|
||||
|
||||
#endif // OS_GRAPHICAL_H
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef OS_GRAPHICAL_H
|
||||
#define OS_GRAPHICAL_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Graphics System Info
|
||||
|
||||
typedef struct OS_GfxInfo OS_GfxInfo;
|
||||
struct OS_GfxInfo
|
||||
{
|
||||
F32 double_click_time;
|
||||
F32 caret_blink_time;
|
||||
F32 default_refresh_rate;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Window Types
|
||||
|
||||
typedef U32 OS_WindowFlags;
|
||||
enum
|
||||
{
|
||||
OS_WindowFlag_CustomBorder = (1<<0),
|
||||
};
|
||||
|
||||
typedef void OS_WindowRepaintFunctionType(OS_Handle window, void *user_data);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Cursor Types
|
||||
|
||||
typedef enum OS_Cursor
|
||||
{
|
||||
OS_Cursor_Pointer,
|
||||
OS_Cursor_IBar,
|
||||
OS_Cursor_LeftRight,
|
||||
OS_Cursor_UpDown,
|
||||
OS_Cursor_DownRight,
|
||||
OS_Cursor_UpRight,
|
||||
OS_Cursor_UpDownLeftRight,
|
||||
OS_Cursor_HandPoint,
|
||||
OS_Cursor_Disabled,
|
||||
OS_Cursor_COUNT,
|
||||
}
|
||||
OS_Cursor;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Generated Code
|
||||
|
||||
#include "os/gfx/generated/os_gfx.meta.h"
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Types
|
||||
|
||||
typedef enum OS_EventKind
|
||||
{
|
||||
OS_EventKind_Null,
|
||||
OS_EventKind_Press,
|
||||
OS_EventKind_Release,
|
||||
OS_EventKind_MouseMove,
|
||||
OS_EventKind_Text,
|
||||
OS_EventKind_Scroll,
|
||||
OS_EventKind_WindowLoseFocus,
|
||||
OS_EventKind_WindowClose,
|
||||
OS_EventKind_FileDrop,
|
||||
OS_EventKind_Wakeup,
|
||||
OS_EventKind_COUNT
|
||||
}
|
||||
OS_EventKind;
|
||||
|
||||
typedef U32 OS_EventFlags;
|
||||
enum
|
||||
{
|
||||
OS_EventFlag_Ctrl = (1<<0),
|
||||
OS_EventFlag_Shift = (1<<1),
|
||||
OS_EventFlag_Alt = (1<<2),
|
||||
};
|
||||
|
||||
typedef struct OS_Event OS_Event;
|
||||
struct OS_Event
|
||||
{
|
||||
OS_Event *next;
|
||||
OS_Event *prev;
|
||||
U64 timestamp_us;
|
||||
OS_Handle window;
|
||||
OS_EventKind kind;
|
||||
OS_EventFlags flags;
|
||||
OS_Key key;
|
||||
B32 is_repeat;
|
||||
B32 right_sided;
|
||||
U32 character;
|
||||
U32 repeat_count;
|
||||
Vec2F32 pos;
|
||||
Vec2F32 delta;
|
||||
String8List strings;
|
||||
};
|
||||
|
||||
typedef struct OS_EventList OS_EventList;
|
||||
struct OS_EventList
|
||||
{
|
||||
U64 count;
|
||||
OS_Event *first;
|
||||
OS_Event *last;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Event Functions (Helpers, Implemented Once)
|
||||
|
||||
internal String8List os_string_list_from_event_flags(Arena *arena, OS_EventFlags flags);
|
||||
internal U32 os_codepoint_from_event_flags_and_key(OS_EventFlags flags, OS_Key key);
|
||||
internal void os_eat_event(OS_EventList *events, OS_Event *event);
|
||||
internal B32 os_key_press(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
|
||||
internal B32 os_key_release(OS_EventList *events, OS_Handle window, OS_EventFlags flags, OS_Key key);
|
||||
internal B32 os_text(OS_EventList *events, OS_Handle window, U32 character);
|
||||
internal OS_EventList os_event_list_copy(Arena *arena, OS_EventList *src);
|
||||
internal void os_event_list_concat_in_place(OS_EventList *dst, OS_EventList *to_push);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void os_gfx_init(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Graphics System Info (Implemented Per-OS)
|
||||
|
||||
internal OS_GfxInfo *os_get_gfx_info(void);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void os_set_clipboard_text(String8 string);
|
||||
internal String8 os_get_clipboard_text(Arena *arena);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title);
|
||||
internal void os_window_close(OS_Handle window);
|
||||
internal void os_window_first_paint(OS_Handle window);
|
||||
internal void os_window_equip_repaint(OS_Handle window, OS_WindowRepaintFunctionType *repaint, void *user_data);
|
||||
internal void os_window_focus(OS_Handle window);
|
||||
internal B32 os_window_is_focused(OS_Handle window);
|
||||
internal B32 os_window_is_fullscreen(OS_Handle window);
|
||||
internal void os_window_set_fullscreen(OS_Handle window, B32 fullscreen);
|
||||
internal B32 os_window_is_maximized(OS_Handle window);
|
||||
internal void os_window_set_maximized(OS_Handle window, B32 maximized);
|
||||
internal void os_window_minimize(OS_Handle window);
|
||||
internal void os_window_bring_to_front(OS_Handle window);
|
||||
internal void os_window_set_monitor(OS_Handle window, OS_Handle monitor);
|
||||
internal void os_window_clear_custom_border_data(OS_Handle handle);
|
||||
internal void os_window_push_custom_title_bar(OS_Handle handle, F32 thickness);
|
||||
internal void os_window_push_custom_edges(OS_Handle handle, F32 thickness);
|
||||
internal void os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect);
|
||||
internal Rng2F32 os_rect_from_window(OS_Handle window);
|
||||
internal Rng2F32 os_client_rect_from_window(OS_Handle window);
|
||||
internal F32 os_dpi_from_window(OS_Handle window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_HandleArray os_push_monitors_array(Arena *arena);
|
||||
internal OS_Handle os_primary_monitor(void);
|
||||
internal OS_Handle os_monitor_from_window(OS_Handle window);
|
||||
internal String8 os_name_from_monitor(Arena *arena, OS_Handle monitor);
|
||||
internal Vec2F32 os_dim_from_monitor(OS_Handle monitor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
internal void os_send_wakeup_event(void);
|
||||
internal OS_EventList os_get_events(Arena *arena, B32 wait);
|
||||
internal OS_EventFlags os_get_event_flags(void);
|
||||
internal B32 os_key_is_down(OS_Key key);
|
||||
internal Vec2F32 os_mouse_from_window(OS_Handle window);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void os_set_cursor(OS_Cursor cursor);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void os_graphical_message(B32 error, String8 title, String8 message);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void os_show_in_filesystem_ui(String8 path);
|
||||
|
||||
#endif // OS_GRAPHICAL_H
|
||||
|
||||
+229
-256
@@ -1,256 +1,229 @@
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_clipboard_text(String8 string)
|
||||
{
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_get_clipboard_text(Arena *arena)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_close(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_first_paint(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_equip_repaint(OS_Handle window, OS_WindowRepaintFunctionType *repaint, void *user_data)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_focus(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_focused(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_fullscreen(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_fullscreen(OS_Handle window, B32 fullscreen)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_maximized(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_maximized(OS_Handle window, B32 maximized)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_minimize(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_bring_to_front(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_monitor(OS_Handle window, OS_Handle monitor)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_clear_custom_border_data(OS_Handle handle)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar(OS_Handle handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_edges(OS_Handle handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect)
|
||||
{
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_rect_from_window(OS_Handle window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_client_rect_from_window(OS_Handle window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_dpi_from_window(OS_Handle window)
|
||||
{
|
||||
return 96.f;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_HandleArray
|
||||
os_push_monitors_array(Arena *arena)
|
||||
{
|
||||
OS_HandleArray arr = {0};
|
||||
return arr;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_primary_monitor(void)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_monitor_from_window(OS_Handle window)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_name_from_monitor(Arena *arena, OS_Handle monitor)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_dim_from_monitor(OS_Handle monitor)
|
||||
{
|
||||
Vec2F32 v = v2f32(1000, 1000);
|
||||
return v;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_send_wakeup_event(void)
|
||||
{
|
||||
}
|
||||
|
||||
internal OS_EventList
|
||||
os_get_events(Arena *arena, B32 wait)
|
||||
{
|
||||
OS_EventList evts = {0};
|
||||
return evts;
|
||||
}
|
||||
|
||||
internal OS_EventFlags
|
||||
os_get_event_flags(void)
|
||||
{
|
||||
OS_EventFlags f = 0;
|
||||
return f;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_key_is_down(OS_Key key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_mouse_from_window(OS_Handle window)
|
||||
{
|
||||
return v2f32(0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_cursor(OS_Cursor cursor)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks System Properties (Implemented Per-OS)
|
||||
|
||||
internal F32
|
||||
os_double_click_time(void)
|
||||
{
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_caret_blink_time(void)
|
||||
{
|
||||
return 1.f;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_default_refresh_rate(void)
|
||||
{
|
||||
return 60.f;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_granular_sleep_enabled(void)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_message(B32 error, String8 title, String8 message)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void
|
||||
os_show_in_filesystem_ui(String8 path)
|
||||
{
|
||||
}
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Main Initialization API (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_gfx_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Clipboards (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_clipboard_text(String8 string)
|
||||
{
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_get_clipboard_text(Arena *arena)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Windows (Implemented Per-OS)
|
||||
|
||||
internal OS_Handle
|
||||
os_window_open(Vec2F32 resolution, OS_WindowFlags flags, String8 title)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_close(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_first_paint(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_equip_repaint(OS_Handle window, OS_WindowRepaintFunctionType *repaint, void *user_data)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_focus(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_focused(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_fullscreen(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_fullscreen(OS_Handle window, B32 fullscreen)
|
||||
{
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_window_is_maximized(OS_Handle window)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_maximized(OS_Handle window, B32 maximized)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_minimize(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_bring_to_front(OS_Handle window)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_set_monitor(OS_Handle window, OS_Handle monitor)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_clear_custom_border_data(OS_Handle handle)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar(OS_Handle handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_edges(OS_Handle handle, F32 thickness)
|
||||
{
|
||||
}
|
||||
|
||||
internal void
|
||||
os_window_push_custom_title_bar_client_area(OS_Handle handle, Rng2F32 rect)
|
||||
{
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_rect_from_window(OS_Handle window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal Rng2F32
|
||||
os_client_rect_from_window(OS_Handle window)
|
||||
{
|
||||
Rng2F32 rect = r2f32(v2f32(0, 0), v2f32(500, 500));
|
||||
return rect;
|
||||
}
|
||||
|
||||
internal F32
|
||||
os_dpi_from_window(OS_Handle window)
|
||||
{
|
||||
return 96.f;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Monitors (Implemented Per-OS)
|
||||
|
||||
internal OS_HandleArray
|
||||
os_push_monitors_array(Arena *arena)
|
||||
{
|
||||
OS_HandleArray arr = {0};
|
||||
return arr;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_primary_monitor(void)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal OS_Handle
|
||||
os_monitor_from_window(OS_Handle window)
|
||||
{
|
||||
OS_Handle handle = {1};
|
||||
return handle;
|
||||
}
|
||||
|
||||
internal String8
|
||||
os_name_from_monitor(Arena *arena, OS_Handle monitor)
|
||||
{
|
||||
return str8_zero();
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_dim_from_monitor(OS_Handle monitor)
|
||||
{
|
||||
Vec2F32 v = v2f32(1000, 1000);
|
||||
return v;
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Events (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_send_wakeup_event(void)
|
||||
{
|
||||
}
|
||||
|
||||
internal OS_EventList
|
||||
os_get_events(Arena *arena, B32 wait)
|
||||
{
|
||||
OS_EventList evts = {0};
|
||||
return evts;
|
||||
}
|
||||
|
||||
internal OS_EventFlags
|
||||
os_get_event_flags(void)
|
||||
{
|
||||
OS_EventFlags f = 0;
|
||||
return f;
|
||||
}
|
||||
|
||||
internal B32
|
||||
os_key_is_down(OS_Key key)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
internal Vec2F32
|
||||
os_mouse_from_window(OS_Handle window)
|
||||
{
|
||||
return v2f32(0, 0);
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Cursors (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_set_cursor(OS_Cursor cursor)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Native User-Facing Graphical Messages (Implemented Per-OS)
|
||||
|
||||
internal void
|
||||
os_graphical_message(B32 error, String8 title, String8 message)
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: @os_hooks Shell Operations
|
||||
|
||||
internal void
|
||||
os_show_in_filesystem_ui(String8 path)
|
||||
{
|
||||
}
|
||||
|
||||
+1525
-1461
File diff suppressed because it is too large
Load Diff
+115
-82
@@ -1,82 +1,115 @@
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef WIN32_GRAPHICAL_H
|
||||
#define WIN32_GRAPHICAL_H
|
||||
|
||||
#pragma comment(lib, "user32")
|
||||
#pragma comment(lib, "gdi32")
|
||||
|
||||
#ifndef WM_NCUAHDRAWCAPTION
|
||||
#define WM_NCUAHDRAWCAPTION (0x00AE)
|
||||
#endif
|
||||
#ifndef WM_NCUAHDRAWFRAME
|
||||
#define WM_NCUAHDRAWFRAME (0x00AF)
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Windows
|
||||
|
||||
typedef struct W32_TitleBarClientArea W32_TitleBarClientArea;
|
||||
struct W32_TitleBarClientArea
|
||||
{
|
||||
W32_TitleBarClientArea *next;
|
||||
Rng2F32 rect;
|
||||
};
|
||||
|
||||
typedef struct W32_Window W32_Window;
|
||||
struct W32_Window
|
||||
{
|
||||
W32_Window *next;
|
||||
W32_Window *prev;
|
||||
HWND hwnd;
|
||||
WINDOWPLACEMENT last_window_placement;
|
||||
OS_WindowRepaintFunctionType *repaint;
|
||||
void *repaint_user_data;
|
||||
F32 dpi;
|
||||
B32 first_paint_done;
|
||||
B32 maximized;
|
||||
B32 custom_border;
|
||||
F32 custom_border_title_thickness;
|
||||
F32 custom_border_edge_thickness;
|
||||
B32 custom_border_composition_enabled;
|
||||
Arena *paint_arena;
|
||||
W32_TitleBarClientArea *first_title_bar_client_area;
|
||||
W32_TitleBarClientArea *last_title_bar_client_area;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Monitor Gathering Bundle
|
||||
|
||||
typedef struct W32_MonitorGatherBundle W32_MonitorGatherBundle;
|
||||
struct W32_MonitorGatherBundle
|
||||
{
|
||||
Arena *arena;
|
||||
OS_HandleList *list;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
internal Rng2F32 w32_base_rect_from_win32_rect(RECT rect);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Windows
|
||||
|
||||
internal OS_Handle os_window_from_w32_window(W32_Window *window);
|
||||
internal W32_Window * w32_window_from_os_window(OS_Handle window);
|
||||
internal W32_Window * w32_window_from_hwnd(HWND hwnd);
|
||||
internal HWND w32_hwnd_from_window(W32_Window *window);
|
||||
internal W32_Window * w32_allocate_window(void);
|
||||
internal void w32_free_window(W32_Window *window);
|
||||
internal OS_Event * w32_push_event(OS_EventKind kind, W32_Window *window);
|
||||
internal OS_Key w32_os_key_from_vkey(WPARAM vkey);
|
||||
internal WPARAM w32_vkey_from_os_key(OS_Key key);
|
||||
internal LRESULT w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Monitors
|
||||
|
||||
internal BOOL w32_monitor_gather_enum_proc(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM bundle_ptr);
|
||||
|
||||
#endif // WIN32_GRAPHICAL_H
|
||||
// Copyright (c) 2024 Epic Games Tools
|
||||
// Licensed under the MIT license (https://opensource.org/license/mit/)
|
||||
|
||||
#ifndef OS_GFX_WIN32_H
|
||||
#define OS_GFX_WIN32_H
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Includes / Libraries
|
||||
|
||||
#include <uxtheme.h>
|
||||
#include <dwmapi.h>
|
||||
#include <shellscalingapi.h>
|
||||
#pragma comment(lib, "gdi32")
|
||||
#pragma comment(lib, "dwmapi")
|
||||
#pragma comment(lib, "UxTheme")
|
||||
#pragma comment(lib, "ole32")
|
||||
#pragma comment(lib, "user32")
|
||||
#ifndef WM_NCUAHDRAWCAPTION
|
||||
#define WM_NCUAHDRAWCAPTION (0x00AE)
|
||||
#endif
|
||||
#ifndef WM_NCUAHDRAWFRAME
|
||||
#define WM_NCUAHDRAWFRAME (0x00AF)
|
||||
#endif
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Windows
|
||||
|
||||
typedef struct OS_W32_TitleBarClientArea OS_W32_TitleBarClientArea;
|
||||
struct OS_W32_TitleBarClientArea
|
||||
{
|
||||
OS_W32_TitleBarClientArea *next;
|
||||
Rng2F32 rect;
|
||||
};
|
||||
|
||||
typedef struct OS_W32_Window OS_W32_Window;
|
||||
struct OS_W32_Window
|
||||
{
|
||||
OS_W32_Window *next;
|
||||
OS_W32_Window *prev;
|
||||
HWND hwnd;
|
||||
WINDOWPLACEMENT last_window_placement;
|
||||
OS_WindowRepaintFunctionType *repaint;
|
||||
void *repaint_user_data;
|
||||
F32 dpi;
|
||||
B32 first_paint_done;
|
||||
B32 maximized;
|
||||
B32 custom_border;
|
||||
F32 custom_border_title_thickness;
|
||||
F32 custom_border_edge_thickness;
|
||||
B32 custom_border_composition_enabled;
|
||||
Arena *paint_arena;
|
||||
OS_W32_TitleBarClientArea *first_title_bar_client_area;
|
||||
OS_W32_TitleBarClientArea *last_title_bar_client_area;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Monitor Gathering Bundle
|
||||
|
||||
typedef struct OS_W32_MonitorGatherBundle OS_W32_MonitorGatherBundle;
|
||||
struct OS_W32_MonitorGatherBundle
|
||||
{
|
||||
Arena *arena;
|
||||
OS_HandleList *list;
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Global State
|
||||
|
||||
typedef struct OS_W32_GfxState OS_W32_GfxState;
|
||||
struct OS_W32_GfxState
|
||||
{
|
||||
Arena *arena;
|
||||
U32 gfx_thread_tid;
|
||||
HINSTANCE hInstance;
|
||||
HCURSOR hCursor;
|
||||
OS_GfxInfo gfx_info;
|
||||
OS_W32_Window *first_window;
|
||||
OS_W32_Window *last_window;
|
||||
OS_W32_Window *free_window;
|
||||
OS_Key key_from_vkey_table[256];
|
||||
};
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Globals
|
||||
|
||||
global OS_W32_GfxState *os_w32_gfx_state = 0;
|
||||
global OS_EventList os_w32_event_list = {0};
|
||||
global Arena *os_w32_event_arena = 0;
|
||||
B32 os_w32_resizing = 0;
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Basic Helpers
|
||||
|
||||
internal Rng2F32 os_w32_rng2f32_from_rect(RECT rect);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Windows
|
||||
|
||||
internal OS_Handle os_w32_handle_from_window(OS_W32_Window *window);
|
||||
internal OS_W32_Window * os_w32_window_from_handle(OS_Handle window);
|
||||
internal OS_W32_Window * os_w32_window_from_hwnd(HWND hwnd);
|
||||
internal HWND os_w32_hwnd_from_window(OS_W32_Window *window);
|
||||
internal OS_W32_Window * os_w32_window_alloc(void);
|
||||
internal void os_w32_window_release(OS_W32_Window *window);
|
||||
internal OS_Event * os_w32_push_event(OS_EventKind kind, OS_W32_Window *window);
|
||||
internal OS_Key os_w32_os_key_from_vkey(WPARAM vkey);
|
||||
internal WPARAM os_w32_vkey_from_os_key(OS_Key key);
|
||||
internal LRESULT os_w32_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
////////////////////////////////
|
||||
//~ rjf: Monitors
|
||||
|
||||
internal BOOL os_w32_monitor_gather_enum_proc(HMONITOR monitor, HDC hdc, LPRECT rect, LPARAM bundle_ptr);
|
||||
|
||||
#endif // OS_GFX_WIN32_H
|
||||
|
||||
Reference in New Issue
Block a user