2016-02-01 05:03:42 +00:00
|
|
|
/*
|
|
|
|
* Mr. 4th Dimention - Allen Webster
|
|
|
|
*
|
|
|
|
* 12.12.2014
|
|
|
|
*
|
|
|
|
* Application Layer for 4coder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
// TOP
|
|
|
|
|
|
|
|
#ifndef FRED_H
|
|
|
|
#define FRED_H
|
|
|
|
|
2016-05-19 16:23:12 +00:00
|
|
|
#define MAX_VIEWS 16
|
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
struct Application_Memory{
|
|
|
|
void *vars_memory;
|
|
|
|
i32 vars_memory_size;
|
|
|
|
void *target_memory;
|
|
|
|
i32 target_memory_size;
|
2016-02-28 20:30:51 +00:00
|
|
|
void *user_memory;
|
|
|
|
i32 user_memory_size;
|
2017-03-29 20:50:29 +00:00
|
|
|
void *debug_memory;
|
|
|
|
i32 debug_memory_size;
|
2016-02-01 05:03:42 +00:00
|
|
|
};
|
|
|
|
|
2017-01-29 00:03:23 +00:00
|
|
|
#define KEY_INPUT_BUFFER_SIZE 8
|
|
|
|
#define KEY_EXTRA_SIZE 2
|
2016-02-01 05:03:42 +00:00
|
|
|
|
|
|
|
struct Key_Input_Data{
|
2017-01-29 00:03:23 +00:00
|
|
|
Key_Event_Data keys[KEY_INPUT_BUFFER_SIZE + KEY_EXTRA_SIZE];
|
2016-02-01 05:03:42 +00:00
|
|
|
i32 count;
|
|
|
|
};
|
2017-01-29 00:03:23 +00:00
|
|
|
static Key_Input_Data null_key_input_data = {0};
|
2016-02-01 05:03:42 +00:00
|
|
|
|
|
|
|
inline Key_Event_Data
|
2017-01-29 00:03:23 +00:00
|
|
|
get_single_key(Key_Input_Data *data, i32 index){
|
|
|
|
Key_Event_Data key = data->keys[index];
|
|
|
|
return(key);
|
2016-02-01 05:03:42 +00:00
|
|
|
}
|
|
|
|
|
2017-03-29 16:32:06 +00:00
|
|
|
struct Input_Summary{
|
2016-02-27 07:44:17 +00:00
|
|
|
Mouse_State mouse;
|
2017-01-29 00:03:23 +00:00
|
|
|
Key_Input_Data keys;
|
2016-06-07 16:26:11 +00:00
|
|
|
f32 dt;
|
2017-03-29 16:32:06 +00:00
|
|
|
};
|
2016-02-01 05:03:42 +00:00
|
|
|
|
2017-03-29 16:32:06 +00:00
|
|
|
struct Command_Line_Parameters{
|
2016-02-01 05:03:42 +00:00
|
|
|
char **argv;
|
2016-08-29 01:03:26 +00:00
|
|
|
int32_t argc;
|
2017-03-29 16:32:06 +00:00
|
|
|
};
|
2016-02-01 05:03:42 +00:00
|
|
|
|
2017-03-29 16:32:06 +00:00
|
|
|
struct Plat_Settings{
|
2016-02-01 05:03:42 +00:00
|
|
|
char *custom_dll;
|
2017-03-29 16:32:06 +00:00
|
|
|
b8 custom_dll_is_strict;
|
|
|
|
b8 fullscreen_window;
|
|
|
|
b8 stream_mode;
|
2016-07-03 22:29:07 +00:00
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
i32 window_w, window_h;
|
|
|
|
i32 window_x, window_y;
|
2016-09-01 03:06:46 +00:00
|
|
|
b8 set_window_pos;
|
|
|
|
b8 set_window_size;
|
2016-02-01 05:03:42 +00:00
|
|
|
b8 maximize_window;
|
2017-03-29 16:32:06 +00:00
|
|
|
|
2016-07-03 22:29:07 +00:00
|
|
|
b8 use_hinting;
|
2017-03-29 16:32:06 +00:00
|
|
|
i32 font_size;
|
|
|
|
};
|
2016-02-01 05:03:42 +00:00
|
|
|
|
2017-01-30 18:41:08 +00:00
|
|
|
#define App_Read_Command_Line_Sig(name) \
|
2017-03-13 23:48:11 +00:00
|
|
|
i32 name(System_Functions *system, Application_Memory *memory, String current_directory, Plat_Settings *plat_settings, char ***files, i32 **file_count, Command_Line_Parameters clparams)
|
2016-02-01 05:03:42 +00:00
|
|
|
|
|
|
|
typedef App_Read_Command_Line_Sig(App_Read_Command_Line);
|
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
struct Custom_API{
|
|
|
|
Get_Binding_Data_Function *get_bindings;
|
|
|
|
_Get_Version_Function *get_alpha_4coder_version;
|
|
|
|
};
|
2016-05-29 19:28:29 +00:00
|
|
|
|
2017-01-23 06:19:43 +00:00
|
|
|
#define App_Init_Sig(name) \
|
|
|
|
void name(System_Functions *system, Render_Target *target, Application_Memory *memory, String clipboard, String current_directory, Custom_API api)
|
2016-02-01 05:03:42 +00:00
|
|
|
|
|
|
|
typedef App_Init_Sig(App_Init);
|
|
|
|
|
2016-05-29 19:28:29 +00:00
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
enum Application_Mouse_Cursor{
|
2017-01-14 03:01:35 +00:00
|
|
|
APP_MOUSE_CURSOR_DEFAULT,
|
|
|
|
APP_MOUSE_CURSOR_ARROW,
|
|
|
|
APP_MOUSE_CURSOR_IBEAM,
|
|
|
|
APP_MOUSE_CURSOR_LEFTRIGHT,
|
|
|
|
APP_MOUSE_CURSOR_UPDOWN,
|
|
|
|
// never below this
|
|
|
|
APP_MOUSE_CURSOR_COUNT
|
2016-02-01 05:03:42 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct Application_Step_Result{
|
2017-01-14 03:01:35 +00:00
|
|
|
Application_Mouse_Cursor mouse_cursor_type;
|
2016-02-01 05:03:42 +00:00
|
|
|
b32 lctrl_lalt_is_altgr;
|
2016-03-16 16:50:26 +00:00
|
|
|
b32 trying_to_kill;
|
|
|
|
b32 perform_kill;
|
2016-05-03 19:33:22 +00:00
|
|
|
b32 animating;
|
2016-02-01 05:03:42 +00:00
|
|
|
};
|
|
|
|
|
2016-05-29 19:28:29 +00:00
|
|
|
struct Application_Step_Input{
|
|
|
|
b32 first_step;
|
|
|
|
f32 dt;
|
|
|
|
Key_Input_Data keys;
|
|
|
|
Mouse_State mouse;
|
|
|
|
String clipboard;
|
|
|
|
};
|
|
|
|
|
2017-03-17 17:45:41 +00:00
|
|
|
#define App_Step_Sig(name) void \
|
|
|
|
name(System_Functions *system, \
|
|
|
|
Render_Target *target, \
|
|
|
|
Application_Memory *memory, \
|
|
|
|
Application_Step_Input *input, \
|
|
|
|
Application_Step_Result *app_result_, \
|
2017-01-14 03:01:35 +00:00
|
|
|
Command_Line_Parameters params)
|
2016-02-01 05:03:42 +00:00
|
|
|
|
|
|
|
typedef App_Step_Sig(App_Step);
|
|
|
|
|
2016-05-29 19:28:29 +00:00
|
|
|
|
2016-02-01 05:03:42 +00:00
|
|
|
struct App_Functions{
|
|
|
|
App_Read_Command_Line *read_command_line;
|
|
|
|
App_Init *init;
|
|
|
|
App_Step *step;
|
|
|
|
};
|
|
|
|
|
|
|
|
#define App_Get_Functions_Sig(name) App_Functions name()
|
|
|
|
typedef App_Get_Functions_Sig(App_Get_Functions);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// BOTTOM
|
|
|
|
|