diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/rodeo.h | 33 | ||||
| -rw-r--r-- | include/rodeo/gfx_t.h | 4 | ||||
| -rw-r--r-- | include/rodeo/math.h | 1 | ||||
| -rw-r--r-- | include/rodeo/math/mat4_t.h | 1 | ||||
| -rw-r--r-- | include/rodeo/math/rng.h | 48 | ||||
| -rw-r--r-- | include/rodeo/math/rng_t.h | 16 | ||||
| -rw-r--r-- | include/rodeo/math/vec2_t.h | 8 | ||||
| -rw-r--r-- | include/rodeo/math/vec3_t.h | 8 | ||||
| -rw-r--r-- | include/rodeo/window.h | 4 |
9 files changed, 101 insertions, 22 deletions
diff --git a/include/rodeo.h b/include/rodeo.h index f60d527..795d6f7 100644 --- a/include/rodeo.h +++ b/include/rodeo.h @@ -9,17 +9,10 @@ #include "rodeo/collision.h" #include "rodeo/gfx.h" #include "rodeo/window.h" - -// -- external -- -#include "stc/cstr.h" +#include "rodeo/math.h" // -- system -- -#include <stdbool.h> -#include <stdio.h> #include <stdint.h> -#include <stdarg.h> -#include <string.h> -#include <limits.h> /// --- Math --- @@ -29,15 +22,6 @@ rodeo_color_RGBAFloat_to_RGBA8(const rodeo_color_RGBAFloat_t color); rodeo_color_RGBAFloat_t rodeo_color_RGBA8_to_RGBAFloat(const rodeo_color_RGBA8_t color); -void -rodeo_random_seed_set(uint64_t seed); - -double -rodeo_random_double_get(void); - -uint64_t -rodeo_random_uint64_get(void); - /// --- Core --- void @@ -48,3 +32,18 @@ rodeo_mainLoop_run( void rodeo_debug_text_draw(uint16_t x, uint16_t y, const char *format, ...); +// intialize all subsystems +void +rodeo_init(float width, float height, cstr window_name, uint32_t audio_channels); + +// deintialize all subsystems +void +rodeo_deinit(void); + +// macro to intialize/deinitialize all subsystems +#define \ +mrodeo_do(width, height, window_name, audio_channels) \ + mrodeo_defer_do( \ + rodeo_init(width, height, window_name, audio_channels), \ + rodeo_deinit() \ + ) diff --git a/include/rodeo/gfx_t.h b/include/rodeo/gfx_t.h index 9ed5f14..40ea58c 100644 --- a/include/rodeo/gfx_t.h +++ b/include/rodeo/gfx_t.h @@ -6,12 +6,12 @@ // -- system -- #include <inttypes.h> -typedef struct irodeo_gfx_texture_internal irodeo_gfx_texture_internal_t; +typedef struct irodeo_gfx_texture_2d irodeo_gfx_texture_2d_t; typedef struct { - irodeo_gfx_texture_internal_t *internal_texture; + irodeo_gfx_texture_2d_t *data; uint32_t width; uint32_t height; } diff --git a/include/rodeo/math.h b/include/rodeo/math.h index 39e9c26..3896fef 100644 --- a/include/rodeo/math.h +++ b/include/rodeo/math.h @@ -6,6 +6,7 @@ #include "rodeo/math/vec2.h" #include "rodeo/math/vec3.h" #include "rodeo/math/mat4.h" +#include "rodeo/math/rng.h" #define mrodeo_math_pi 3.1415927410125732421875f diff --git a/include/rodeo/math/mat4_t.h b/include/rodeo/math/mat4_t.h index 2893444..e00656c 100644 --- a/include/rodeo/math/mat4_t.h +++ b/include/rodeo/math/mat4_t.h @@ -1,6 +1,5 @@ #pragma once - typedef struct { diff --git a/include/rodeo/math/rng.h b/include/rodeo/math/rng.h new file mode 100644 index 0000000..53f1f76 --- /dev/null +++ b/include/rodeo/math/rng.h @@ -0,0 +1,48 @@ +#pragma once + +// -- internal -- +#include "rodeo/math/rng_t.h" + +// -- system -- +#include <inttypes.h> + +void +rodeo_math_rng_init(void); + +void +rodeo_math_rng_deinit(void); + +rodeo_math_rng_generator_t +rodeo_math_rng_generator_create(uint64_t seed); + +void +rodeo_math_rng_generator_destroy(rodeo_math_rng_generator_t generator); + +double +rodeo_math_rng_double_get(rodeo_math_rng_generator_t generator); + +#define irodeo_math_rng_double_get_default() rodeo_math_rng_double_get((rodeo_math_rng_generator_t){0}) + +float +rodeo_math_rng_float_get(rodeo_math_rng_generator_t generator); + +#define irodeo_math_rng_float_get_default() rodeo_math_rng_float_get((rodeo_math_rng_generator_t){0}) + +uint64_t +rodeo_math_rng_uint64_get(rodeo_math_rng_generator_t generator); + +#define irodeo_math_rng_uint64_get_default() rodeo_math_rng_uint64_get((rodeo_math_rng_generator_t){0}) + +uint32_t +rodeo_math_rng_uint32_get(rodeo_math_rng_generator_t generator); + +#define irodeo_math_rng_uint32_get_default() rodeo_math_rng_uint32_get((rodeo_math_rng_generator_t){0}) + +#define \ +mrodeo_math_rng_do( \ +) \ + mrodeo_defer_do( \ + rodeo_math_rng_init(), \ + rodeo_math_rng_deinit() \ + ) + diff --git a/include/rodeo/math/rng_t.h b/include/rodeo/math/rng_t.h new file mode 100644 index 0000000..8c527ed --- /dev/null +++ b/include/rodeo/math/rng_t.h @@ -0,0 +1,16 @@ +#pragma once + +// -- system -- +#include <inttypes.h> + +typedef struct irodeo_math_rng_generator irodeo_math_rng_generator_t; + +typedef +struct +{ + // note: a seed value of '0' is reserved for when using the + // global seed is desired. + uint64_t seed; + irodeo_math_rng_generator_t *data; +} +rodeo_math_rng_generator_t; diff --git a/include/rodeo/math/vec2_t.h b/include/rodeo/math/vec2_t.h index 61b941e..22717c6 100644 --- a/include/rodeo/math/vec2_t.h +++ b/include/rodeo/math/vec2_t.h @@ -6,4 +6,12 @@ struct float x; float y; } +rodeo_math_vec2_val_t; + +typedef +union +{ + rodeo_math_vec2_val_t val; + float raw[2]; +} rodeo_math_vec2_t; diff --git a/include/rodeo/math/vec3_t.h b/include/rodeo/math/vec3_t.h index 711ad98..a3b3a36 100644 --- a/include/rodeo/math/vec3_t.h +++ b/include/rodeo/math/vec3_t.h @@ -7,4 +7,12 @@ struct float y; float z; } +rodeo_math_vec3_val_t; + +typedef +union +{ + rodeo_math_vec3_val_t val; + float raw[3]; +} rodeo_math_vec3_t; diff --git a/include/rodeo/window.h b/include/rodeo/window.h index 2dcfab2..df73b4f 100644 --- a/include/rodeo/window.h +++ b/include/rodeo/window.h @@ -13,8 +13,8 @@ void rodeo_window_init( - uint16_t screen_height, - uint16_t screen_width, + uint32_t screen_height, + uint32_t screen_width, cstr title ); |
