Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*===============================================================================================
- // Platform API Struct
- ===============================================================================================*/
- // General API for platform
- typedef struct gs_platform_i
- {
- /*============================================================
- // Platform Initilization / De-Initialization
- ============================================================*/
- gs_result ( * gs_platform_init )();
- gs_result ( * gs_platform_shutdown )();
- /*============================================================
- // Platform Util
- ============================================================*/
- u32 ( * gs_platform_ticks )();
- void ( * gs_platform_delay )( u32 ticks );
- /*============================================================
- // Platform UUID
- ============================================================*/
- struct gs_uuid ( * gs_platform_generate_uuid )();
- void ( * gs_uuid_to_string )( char* temp_buffer, const struct gs_uuid* uuid ); // Expects a temp buffer with at leat 32 bytes
- u32 ( * gs_hash_uuid )( const struct gs_uuid* uuid );
- /*============================================================
- // Platform Input
- ============================================================*/
- struct gs_platform_input* ( * gs_platform_create_input )();
- gs_result ( * gs_platform_process_input )( struct gs_platform_input* input );
- b32 ( * gs_platform_key_pressed )( struct gs_platform_input* input, gs_platform_keycode code );
- b32 ( * gs_platform_key_down )( struct gs_platform_input* input, gs_platform_keycode code );
- b32 ( * gs_platform_key_released )( struct gs_platform_input* input, gs_platform_keycode code );
- b32 ( * gs_platform_mouse_pressed )( struct gs_platform_input* input, gs_mouse_button_code code );
- b32 ( * gs_platform_mouse_down )( struct gs_platform_input* input, gs_mouse_button_code code );
- b32 ( * gs_platform_mouse_released )( struct gs_platform_input* input, gs_mouse_button_code code );
- gs_vec2 ( * gs_platform_mouse_delta )( struct gs_platform_input* input );
- gs_vec2 ( * gs_platform_mouse_position )( struct gs_platform_input* input );
- void ( * gs_platform_mouse_position_f32 )( struct gs_platform_input* input, f32* x, f32* y );
- void ( * gs_platform_mouse_wheel )( struct gs_platform_input* input, f32* x, f32* y );
- void ( * gs_platform_press_key )( struct gs_platform_input* input, gs_platform_keycode code );
- void ( * gs_platform_release_key )( struct gs_platform_input* input, gs_platform_keycode code );
- /*============================================================
- // Platform Window
- ============================================================*/
- struct gs_platform_window* ( * gs_platform_create_window )( const char* title, u32 width, u32 height );
- void ( * gs_platform_window_swap_buffer )( struct gs_platform_window* win );
- gs_vec2 ( * gs_platform_window_size )( struct gs_platform_window* win );
- void ( * gs_platform_window_width_height )( struct gs_platform_window* win, s32* width, s32* height );
- void ( * gs_platform_set_cursor )( struct gs_platform_window* win, gs_platform_cursor cursor );
- /*============================================================
- // Platform File IO
- ============================================================*/
- // Will return a null buffer if file does not exist or allocation fails
- char* gs_read_file_contents_into_string_null_term (const char* file_path, const char* mode, usize* sz );
- gs_result gs_write_str_to_file (const char* contents, const char* mode, usize sz, const char* output_path );
- } gs_platform_i;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement