2017-06-30 01:13:20 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 06.29.2017
|
|
|
|
*
|
|
|
|
* Types and functions for communication between C++ and Objective-C layers.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#if !defined(OSX_OBJECTIVE_C_TO_CPP_LINKS_H)
|
|
|
|
#define OSX_OBJECTIVE_C_TO_CPP_LINKS_H
|
|
|
|
|
2017-11-07 21:35:26 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2017-11-08 01:15:09 +00:00
|
|
|
#if 0
|
2017-11-07 21:35:26 +00:00
|
|
|
#define DBG_POINT() fprintf(stdout, "%s\n", __FILE__ ":" LINE_STR ":")
|
|
|
|
#else
|
|
|
|
#define DBG_POINT()
|
|
|
|
#endif
|
|
|
|
|
2017-06-30 01:13:20 +00:00
|
|
|
typedef enum OSX_Mouse_Event_Type{
|
|
|
|
MouseType_Move,
|
|
|
|
MouseType_Press,
|
|
|
|
MouseType_Release,
|
|
|
|
} OSX_Mouse_Event_Type;
|
|
|
|
|
|
|
|
typedef struct OSX_Keyboard_Modifiers{
|
|
|
|
b32 shift;
|
|
|
|
b32 command;
|
|
|
|
b32 control;
|
|
|
|
b32 option;
|
2017-11-05 04:42:55 +00:00
|
|
|
b32 caps;
|
2017-06-30 01:13:20 +00:00
|
|
|
} OSX_Keyboard_Modifiers;
|
|
|
|
|
2017-11-05 04:42:55 +00:00
|
|
|
typedef struct OSX_Objective_C_Vars{
|
2017-06-30 01:13:20 +00:00
|
|
|
i32 width, height;
|
2017-11-28 19:19:08 +00:00
|
|
|
b32 gl_is_initialized;
|
2017-06-30 01:13:20 +00:00
|
|
|
b32 running;
|
|
|
|
u32 key_count;
|
|
|
|
u32 keys[8];
|
|
|
|
|
|
|
|
u32 prev_clipboard_change_count;
|
|
|
|
b32 has_clipboard_item;
|
|
|
|
void *clipboard_data;
|
2017-11-27 17:14:59 +00:00
|
|
|
u32 clipboard_size;
|
|
|
|
u32 clipboard_max;
|
2017-06-30 01:13:20 +00:00
|
|
|
b32 just_posted_to_clipboard;
|
2017-11-07 21:35:26 +00:00
|
|
|
|
2017-09-10 18:40:11 +00:00
|
|
|
char *clipboard_space;
|
2019-12-18 03:38:08 +00:00
|
|
|
u64 clipboard_space_max;
|
2017-11-07 21:35:26 +00:00
|
|
|
|
2017-09-26 15:12:51 +00:00
|
|
|
b32 full_screen;
|
|
|
|
b32 do_toggle;
|
2017-11-07 21:35:26 +00:00
|
|
|
|
2017-09-26 15:44:13 +00:00
|
|
|
i32 argc;
|
|
|
|
char **argv;
|
2017-11-05 04:42:55 +00:00
|
|
|
} OSX_Objective_C_Vars;
|
2017-06-30 01:13:20 +00:00
|
|
|
|
2017-11-17 22:53:17 +00:00
|
|
|
typedef struct OSX_Loadable_Fonts{
|
|
|
|
char **names;
|
|
|
|
char **paths;
|
|
|
|
i32 count;
|
|
|
|
} OSX_Loadable_Fonts;
|
|
|
|
|
2017-11-20 20:05:14 +00:00
|
|
|
typedef struct OSX_Font_Match{
|
|
|
|
char *path;
|
|
|
|
b32 used_base_file;
|
|
|
|
} OSX_Font_Match;
|
|
|
|
|
2017-06-30 01:13:20 +00:00
|
|
|
// In C++ layer.
|
2017-11-05 04:42:55 +00:00
|
|
|
extern OSX_Objective_C_Vars osx_objc;
|
2017-06-30 01:13:20 +00:00
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void*
|
2019-12-18 03:38:08 +00:00
|
|
|
osx_allocate(u64 size);
|
2017-06-30 01:13:20 +00:00
|
|
|
|
2017-11-07 21:35:26 +00:00
|
|
|
external void
|
2019-12-18 03:38:08 +00:00
|
|
|
osx_free(void *ptr, u64 size);
|
2017-11-07 21:35:26 +00:00
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_resize(int width, int height);
|
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_character_input(u32 code, OSX_Keyboard_Modifiers modifier_flags);
|
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_mouse(i32 mx, i32 my, u32 type);
|
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_mouse_wheel(float dx, float dy);
|
|
|
|
|
2017-11-07 21:35:26 +00:00
|
|
|
external void
|
|
|
|
osx_try_to_close(void);
|
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_step();
|
|
|
|
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:13:20 +00:00
|
|
|
osx_init();
|
|
|
|
|
2017-11-14 21:35:17 +00:00
|
|
|
external void
|
|
|
|
osx_log(char *m, i32 l);
|
|
|
|
|
2017-06-30 01:21:06 +00:00
|
|
|
// In Objective-C layer.
|
2017-06-30 01:28:34 +00:00
|
|
|
external void
|
2017-06-30 01:21:06 +00:00
|
|
|
osx_post_to_clipboard(char *str);
|
|
|
|
|
2017-09-26 15:12:51 +00:00
|
|
|
external void
|
|
|
|
osx_error_dialogue(char *str);
|
|
|
|
|
2017-11-04 05:07:14 +00:00
|
|
|
external void
|
|
|
|
osx_add_file_listener(char *file_name);
|
|
|
|
|
|
|
|
external void
|
|
|
|
osx_remove_file_listener(char *file_name);
|
|
|
|
|
|
|
|
external i32
|
|
|
|
osx_get_file_change_event(char *buffer, i32 max, i32 *size);
|
|
|
|
|
2017-11-08 04:41:45 +00:00
|
|
|
external void
|
|
|
|
osx_show_cursor(i32 show_inc, i32 cursor_type);
|
|
|
|
|
2017-11-11 01:01:03 +00:00
|
|
|
external void
|
|
|
|
osx_begin_render(void);
|
2017-11-11 00:58:47 +00:00
|
|
|
|
2017-11-11 01:01:03 +00:00
|
|
|
external void
|
|
|
|
osx_end_render(void);
|
2017-11-11 00:58:47 +00:00
|
|
|
|
2017-11-08 00:18:57 +00:00
|
|
|
external void
|
|
|
|
osx_schedule_step(void);
|
|
|
|
|
2017-11-08 04:41:45 +00:00
|
|
|
external void
|
|
|
|
osx_toggle_fullscreen(void);
|
|
|
|
|
|
|
|
external b32
|
|
|
|
osx_is_fullscreen(void);
|
|
|
|
|
2017-11-07 21:35:26 +00:00
|
|
|
external void
|
|
|
|
osx_close_app(void);
|
|
|
|
|
2017-11-15 04:33:15 +00:00
|
|
|
external f32
|
|
|
|
osx_timer_seconds(void);
|
|
|
|
|
2017-11-20 20:05:14 +00:00
|
|
|
external OSX_Font_Match
|
|
|
|
osx_get_font_match(char *name, i32 pt_size, b32 italic, b32 bold);
|
|
|
|
|
2017-11-17 22:53:17 +00:00
|
|
|
external OSX_Loadable_Fonts
|
|
|
|
osx_list_loadable_fonts(void);
|
|
|
|
|
2017-11-30 15:44:08 +00:00
|
|
|
external void
|
|
|
|
osx_change_title(char *str);
|
|
|
|
|
2018-12-17 22:21:39 +00:00
|
|
|
external OSX_Keyboard_Modifiers
|
|
|
|
osx_get_modifiers(void);
|
|
|
|
|
2017-06-30 01:13:20 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|