Experiments with keyboard bindings for Mac alt keys, done and undone I think. get_clock fix for Mac

master
Allen Webster 2017-11-14 23:33:15 -05:00
parent cc80e081ff
commit 162ffe828a
7 changed files with 29 additions and 14 deletions

View File

@ -64,7 +64,7 @@ bind(Bind_Helper *context, Key_Code code, int32_t m, int32_t t, Generic_Command
}
else if (t == 1){
bind(context, code, MDFR_CTRL|MDFR_CMND|f, cmd);
bind(context, code, MDFR_ALT|MDFR_CMND|f, cmd);
bind(context, code, MDFR_ALT|f, cmd);
}
}break;
}

View File

@ -297,7 +297,7 @@ system_set_font(System_Functions *system, Partition *part, Render_Font *font, ch
}
}
else{
LOGF("font \"%.*s\" name is too long to load in current build (max %u)\n", filename_len, filename, sizeof(font->filename) - 1);
LOGF("font \"%.*s\" name is too long to load in current build (max %u)\n", filename_len, filename, (u32)(sizeof(font->filename) - 1));
}
}

View File

@ -234,6 +234,15 @@ Sys_Get_4ed_Path_Sig(system_get_4ed_path){
}
#include "unix_4ed_functions.cpp"
internal
Sys_Now_Time_Sig(system_now_time){
struct timespec spec;
clock_gettime(CLOCK_REALTIME, &spec);
u64 result = (spec.tv_sec*UINT64_C(1000000)) + (spec.tv_nsec/UINT64_C(1000));
return(result);
}
#include "4ed_shared_file_handling.cpp"
////////////////////////////////

View File

@ -126,6 +126,14 @@ Sys_Get_4ed_Path_Sig(system_get_4ed_path){
//#include "mac_fd_check.cpp"
#include "unix_4ed_functions.cpp"
internal
Sys_Now_Time_Sig(system_now_time){
f64 t = osx_timer_seconds();
u64 result = (u64)(t*1000000.f);
return(result);
}
#include "4ed_shared_file_handling.cpp"
////////////////////////////////

View File

@ -86,6 +86,7 @@ osx_error_dialogue(char *str){
static DISPLINK_SIG(osx_display_link);
@implementation My4coderView
- (void)keyDown:(NSEvent *)event{
NSString *real = [event charactersIgnoringModifiers];
NSString *with_mods = [event characters];
@ -710,6 +711,12 @@ osx_close_app(void){
[NSApp terminate: nil];
}
f32
osx_timer_seconds(void){
f32 result = CACurrentMediaTime();
return(result);
}
int
main(int argc, char **argv){
memset(&osx_objc, 0, sizeof(osx_objc));

View File

@ -126,6 +126,9 @@ osx_is_fullscreen(void);
external void
osx_close_app(void);
external f32
osx_timer_seconds(void);
#endif
// BOTTOM

View File

@ -440,17 +440,5 @@ system_directory_exists(char *path){
return(result);
}
//
// Time
//
internal
Sys_Now_Time_Sig(system_now_time){
struct timespec spec;
clock_gettime(CLOCK_REALTIME, &spec);
u64 result = (spec.tv_sec * UINT64_C(1000000)) + (spec.tv_nsec / UINT64_C(1000));
return(result);
}
// BOTTOM