4coder/4ed.h

131 lines
3.1 KiB
C
Raw Normal View History

2016-02-01 05:03:42 +00:00
/*
* Mr. 4th Dimention - Allen Webster
*
* 12.12.2014
*
* Application Layer for 4coder
*
*/
// TOP
#if !defined(FRED_H)
2016-02-01 05:03:42 +00:00
#define FRED_H
2016-05-19 16:23:12 +00:00
#define MAX_VIEWS 16
2019-06-01 23:58:28 +00:00
// TODO(allen): This is DONE! GET RID OF IT NAO!
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;
void *debug_memory;
i32 debug_memory_size;
2016-02-01 05:03:42 +00:00
};
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen): // TODO(allen):
// TODO(allen): Fix this nonsense
#define KEY_INPUT_BUFFER_SIZE 8
#define KEY_EXTRA_SIZE 5
2016-02-01 05:03:42 +00:00
struct Key_Input_Data{
Key_Event_Data keys[KEY_INPUT_BUFFER_SIZE + KEY_EXTRA_SIZE];
2016-02-01 05:03:42 +00:00
i32 count;
b8 modifiers[MDFR_INDEX_COUNT];
2016-02-01 05:03:42 +00:00
};
2017-07-03 15:43:51 +00:00
typedef u8 Log_To_Type;
enum{
LogTo_Nothing,
LogTo_Stdout,
LogTo_LogFile,
LogTo_COUNT
};
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;
2016-07-03 22:29:07 +00:00
2017-07-03 15:43:51 +00:00
u8 use_log;
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) \
2019-06-01 23:58:28 +00:00
i32 name(System_Functions *system, Application_Memory *memory, String_Const_u8 current_directory, Plat_Settings *plat_settings, char ***files, i32 **file_count, i32 argc, char **argv)
2016-02-01 05:03:42 +00:00
typedef App_Read_Command_Line_Sig(App_Read_Command_Line);
struct Custom_API{
Get_Binding_Data_Function *get_bindings;
_Get_Version_Function *get_alpha_4coder_version;
};
#define App_Init_Sig(name) \
2019-06-01 23:58:28 +00:00
void name(System_Functions *system, Render_Target *target, Application_Memory *memory, String_Const_u8 clipboard, String_Const_u8 current_directory, Custom_API api)
2016-02-01 05:03:42 +00:00
typedef App_Init_Sig(App_Init);
#include "4ed_cursor_codes.h"
2016-02-01 05:03:42 +00:00
struct Application_Step_Result{
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 perform_kill;
b32 animating;
b32 has_new_title;
char *title_string;
2016-02-01 05:03:42 +00:00
};
struct Application_Step_Input{
b32 first_step;
f32 dt;
Key_Input_Data keys;
Mouse_State mouse;
2019-06-01 23:58:28 +00:00
String_Const_u8 clipboard;
b32 clipboard_changed;
2018-03-03 07:46:44 +00:00
b32 trying_to_kill;
u32 debug_number;
};
2018-03-03 07:46:44 +00:00
#define App_Step_Sig(name) Application_Step_Result \
name(System_Functions *system, \
Render_Target *target, \
Application_Memory *memory, \
2018-03-03 07:46:44 +00:00
Application_Step_Input *input)
2016-02-01 05:03:42 +00:00
typedef App_Step_Sig(App_Step);
2019-08-16 02:54:06 +00:00
typedef b32 Log_Function(String_Const_u8 str);
typedef Log_Function *App_Get_Logger(System_Functions *system);
2016-02-01 05:03:42 +00:00
struct App_Functions{
2019-08-16 02:54:06 +00:00
App_Get_Logger *get_logger;
2016-02-01 05:03:42 +00:00
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