diff options
| author | realtradam <[email protected]> | 2023-01-11 22:09:48 -0500 |
|---|---|---|
| committer | realtradam <[email protected]> | 2023-01-11 22:09:48 -0500 |
| commit | b172c2a6b22796dc16c059979d2ec6108b0402e4 (patch) | |
| tree | 9eda4db6d584b4c0415d30c9b5295aaf541f938b /include | |
| parent | b4bc89485ab18ccdc2e381e3e3f2c3bb5e346e1e (diff) | |
| download | RodeoKit-b172c2a6b22796dc16c059979d2ec6108b0402e4.tar.gz RodeoKit-b172c2a6b22796dc16c059979d2ec6108b0402e4.zip | |
isolated dependencies into seperate compilation unit, added basic logging
Diffstat (limited to 'include')
| -rw-r--r-- | include/rodeo.h | 41 | ||||
| -rw-r--r-- | include/rodeo_config.h | 2 | ||||
| -rw-r--r-- | include/rodeo_math.h | 8 | ||||
| -rw-r--r-- | include/rodeo_types.h | 47 |
4 files changed, 42 insertions, 56 deletions
diff --git a/include/rodeo.h b/include/rodeo.h index 4686cb5..7b29d17 100644 --- a/include/rodeo.h +++ b/include/rodeo.h @@ -1,19 +1,19 @@ + +// public internal +#include "rodeo_types.h" + +// system #include <stdbool.h> #include <stdio.h> #include <string.h> #include <limits.h> -#include "SDL2/SDL.h" -#include "SDL2/SDL_syswm.h" -#include "bgfx/c99/bgfx.h" - -#include "rodeo_types.h" void Rodeo__\ init_window( - Rodeo__data_t* state, + Rodeo__data_p *state, int screen_height, int screen_width, char* title @@ -21,7 +21,7 @@ init_window( void Rodeo__\ -deinit_window(Rodeo__data_t* state); +deinit_window(Rodeo__data_p state); void Rodeo__\ @@ -29,15 +29,19 @@ quit(); void Rodeo__\ -begin(Rodeo__data_t* state); +begin(Rodeo__data_p state); void Rodeo__\ -end(Rodeo__data_t* state); +end(Rodeo__data_p state); + +bool +Rodeo__\ +should_quit(Rodeo__data_p state); void Rodeo__\ -draw_debug_text(u_int16_t x, u_int16_t y, const char *format, ...); +draw_debug_text(uint16_t x, uint16_t y, const char *format, ...); const char * Rodeo__\ @@ -45,19 +49,16 @@ get_renderer_name_as_string(); void Rodeo__\ -flush_batch(Rodeo__data_t *state); +flush_batch(Rodeo__data_p state); void Rodeo__\ draw_rectangle( - Rodeo__data_t *state, - u_int16_t x, - u_int16_t y, - u_int16_t width, - u_int16_t height, - struct Rodeo__color_rgba_t color + Rodeo__data_p state, + uint16_t x, + uint16_t y, + uint16_t width, + uint16_t height, + Rodeo__color_rgba_t color ); -bgfx_shader_handle_t -Rodeo__\ -load_shader(const char* path); diff --git a/include/rodeo_config.h b/include/rodeo_config.h new file mode 100644 index 0000000..55bf057 --- /dev/null +++ b/include/rodeo_config.h @@ -0,0 +1,2 @@ + +#define RODEO__MAX_VERTEX_SIZE 8192 diff --git a/include/rodeo_math.h b/include/rodeo_math.h index 13db9b3..f7df53f 100644 --- a/include/rodeo_math.h +++ b/include/rodeo_math.h @@ -1,7 +1,11 @@ -#include "stdint.h" + +// public internal #include "rodeo_types.h" +// system +#include "stdint.h" + uint32_t Rodeo__\ Math__\ -color_rgba_to_uint32(const struct Rodeo__color_rgba_t color); +color_rgba_to_uint32(const Rodeo__color_rgba_t color); diff --git a/include/rodeo_types.h b/include/rodeo_types.h index 08748e5..fd4ed82 100644 --- a/include/rodeo_types.h +++ b/include/rodeo_types.h @@ -1,57 +1,36 @@ #pragma once + +// system #include <stdbool.h> #include <stdint.h> -#include "SDL2/SDL.h" -#include "SDL2/SDL_syswm.h" -#include "bgfx/c99/bgfx.h" - -#define RODEO__MAX_VERTEX_SIZE 8192 - typedef struct Rodeo__\ -color_rgba_t +color_rgba { float red; float green; float blue; float alpha; -} Rodeo__color_t; +} +Rodeo__\ +color_rgba_t; typedef struct -Rodeo__\ -position_color_vertex_t +Rodeo__position_color_vertex { float x; float y; float z; uint32_t abgr; -} Rodeo__position_color_vertex_t; +} +Rodeo__\ +position_color_vertex_t; typedef struct -Rodeo__\ -data_t -{ - SDL_Window* window; - SDL_Surface* screen_surface; - SDL_SysWMinfo wmi; - int screen_width; - int screen_height; - SDL_Event sdl_event; - bool quit; - - bgfx_vertex_layout_t vertex_layout; - bgfx_dynamic_vertex_buffer_handle_t vertex_buffer_handle; - bgfx_dynamic_index_buffer_handle_t index_buffer_handle; - uint16_t vertex_size; - Rodeo__position_color_vertex_t batched_vertices[RODEO__MAX_VERTEX_SIZE]; - uint16_t index_count; - uint16_t index_size; - uint16_t batched_indices[(RODEO__MAX_VERTEX_SIZE / 4) * 6]; - bgfx_shader_handle_t vertex_shader; - bgfx_shader_handle_t fragment_shader; - bgfx_program_handle_t program_shader; -} Rodeo__data_t; +Rodeo__data +*Rodeo__\ +data_p; |
