From 26fd4cd230396d3b1e8081638dce1ce22094da46 Mon Sep 17 00:00:00 2001 From: Yuval Dolev Date: Wed, 1 Jan 2020 00:07:21 +0200 Subject: [PATCH] Finished most of the system api functions (a few will be implemented later). --- platform_mac/mac_4ed.mm | 38 +++++++++++++++++++++++++++++++ platform_mac/mac_4ed_functions.mm | 21 +++++++---------- 2 files changed, 46 insertions(+), 13 deletions(-) diff --git a/platform_mac/mac_4ed.mm b/platform_mac/mac_4ed.mm index ed67979f..90463bc6 100644 --- a/platform_mac/mac_4ed.mm +++ b/platform_mac/mac_4ed.mm @@ -71,6 +71,37 @@ #define global static #define external extern "C" +struct Control_Keys{ + b8 l_ctrl; + b8 r_ctrl; + b8 l_alt; + b8 r_alt; +}; + +struct Mac_Input_Chunk_Transient{ + Input_List event_list; + b8 mouse_l_press; + b8 mouse_l_release; + b8 mouse_r_press; + b8 mouse_r_release; + b8 out_of_window; + i8 mouse_wheel; + b8 trying_to_kill; +}; + +struct Mac_Input_Chunk_Persistent{ + Vec2_i32 mouse; + Control_Keys controls; + Input_Modifier_Set_Fixed modifiers; + b8 mouse_l; + b8 mouse_r; +}; + +struct Mac_Input_Chunk{ + Mac_Input_Chunk_Transient trans; + Mac_Input_Chunk_Persistent pers; +}; + //////////////////////////////// #define SLASH '/' @@ -128,6 +159,13 @@ struct Mac_Vars { Thread_Context *tctx; Arena* frame_arena; + Mac_Input_Chunk input_chunk; + + b8 full_screen; + b8 do_toggle; + + i32 cursor_show; + i32 prev_cursor_show; String_Const_u8 binary_path; diff --git a/platform_mac/mac_4ed_functions.mm b/platform_mac/mac_4ed_functions.mm index 4ef30169..bae982e8 100644 --- a/platform_mac/mac_4ed_functions.mm +++ b/platform_mac/mac_4ed_functions.mm @@ -766,33 +766,28 @@ system_memory_annotation_sig(){ function system_show_mouse_cursor_sig(){ - NotImplemented; + mac_vars.cursor_show = show; } function system_set_fullscreen_sig(){ - b32 result = false; + // NOTE(yuval): Read comment in system_set_fullscreen_sig in win32_4ed.cpp + mac_vars.do_toggle = (mac_vars.full_screen != full_screen); - NotImplemented; - - return(result); + b32 success = true; + return(success); } function system_is_fullscreen_sig(){ - b32 result = false; - - NotImplemented; - + // NOTE(yuval): Read comment in system_is_fullscreen_sig in win32_4ed.cpp + b32 result = (mac_vars.full_screen != mac_vars.do_toggle); return(result); } function system_get_keyboard_modifiers_sig(){ - Input_Modifier_Set result = {}; - - NotImplemented; - + Input_Modifier_Set result = copy_modifier_set(arena, &mac_vars.input_chunk.pers.modifiers); return(result); }