diff options
| author | realtradam <[email protected]> | 2023-03-25 01:25:05 -0400 |
|---|---|---|
| committer | realtradam <[email protected]> | 2023-03-25 01:25:05 -0400 |
| commit | 2577adf913e292a4a515e7dfc4023e37e8177f46 (patch) | |
| tree | b6340f698487ae0dc25ffc9cfc521f8698f63c6c /include | |
| parent | b2fdd29e4965b096e285a17162b268710077ea04 (diff) | |
| download | RodeoKit-2577adf913e292a4a515e7dfc4023e37e8177f46.tar.gz RodeoKit-2577adf913e292a4a515e7dfc4023e37e8177f46.zip | |
progress on getting textures working
Diffstat (limited to 'include')
| -rw-r--r-- | include/rodeo.h | 37 | ||||
| -rw-r--r-- | include/rodeo_types.h | 70 |
2 files changed, 77 insertions, 30 deletions
diff --git a/include/rodeo.h b/include/rodeo.h index 8b38826..f54792b 100644 --- a/include/rodeo.h +++ b/include/rodeo.h @@ -32,11 +32,15 @@ mrodeo_vargs_do(final_arg) \ /// --- Math --- -uint32_t -rodeo_rgba_to_uint32(const rodeo_rgba_t color); +rodeo_RGBA8_t +rodeo_RGBAFloat_to_RGBA8(const rodeo_RGBAFloat_t color); +rodeo_BGRA8_t +rodeo_RGBA8_to_BGRA8(const rodeo_RGBA8_t color); /// --- Core --- +extern rodeo_texture_2d_t rodeo_texture_2d_default; + #define \ mrodeo_window_do( \ screen_height, \ @@ -79,7 +83,7 @@ rodeo_frame_end(void); void rodeo_mainloop_run( - rodeo_mainloop_function main_loop_func + rodeo_mainLoop_function main_loop_func ); bool @@ -100,25 +104,22 @@ rodeo_renderer_flush(void); void rodeo_rectangle_draw( rodeo_rectangle_t rectangle, - rodeo_rgba_t color + rodeo_RGBAFloat_t color ); -//rodeo_texture_2d_t* -//rodeo_texture2D_create( -// uint32_t width, -// uint32_t height, -// char *memory -//); - -//rodeo_texture_2d_p -//rodeo_texture_2d_create_default(void); +rodeo_texture_2d_t +rodeo_texture_2d_create_from_RGBA8( + const uint32_t width, + const uint32_t height, + const uint8_t memory[] +); void -rodeo_texture2D_draw( - rodeo_rectangle_t source, - rodeo_rectangle_t destination, - rodeo_rgba_t color, - rodeo_texture_2d_p texture +rodeo_texture_2d_draw( + const rodeo_rectangle_t source, + const rodeo_rectangle_t destination, + const rodeo_RGBAFloat_t color, + const rodeo_texture_2d_t *texture ); /// --- String --- diff --git a/include/rodeo_types.h b/include/rodeo_types.h index a0d3d4e..5f9925e 100644 --- a/include/rodeo_types.h +++ b/include/rodeo_types.h @@ -5,29 +5,64 @@ #include <stdint.h> #include <stddef.h> -typedef struct +typedef struct irodeo_texture_internal_t irodeo_texture_internal_t; +typedef irodeo_texture_internal_t *rodeo_texture_internal_p; + +typedef union { - float red; - float green; - float blue; - float alpha; + struct { + float red; + float green; + float blue; + float alpha; + }; + float array[4]; } -rodeo_rgba_t; +rodeo_RGBAFloat_t; + +typedef union +{ + struct + { + uint8_t red; + uint8_t green; + uint8_t blue; + uint8_t alpha; + }; + uint32_t rgba; + uint8_t array[4]; +} +rodeo_RGBA8_t; + +typedef union +{ + struct + { + uint8_t blue; + uint8_t green; + uint8_t red; + uint8_t alpha; + }; + uint32_t bgra; + uint8_t array[4]; +} +rodeo_BGRA8_t; typedef struct { float x; float y; float z; - uint32_t abgr; - float tex_x; - float tex_y; + uint32_t bgra; + float texture_x; + float texture_y; + float texture_id; } rodeo_vertex_t; typedef void -(*rodeo_mainloop_function)(void); +(*rodeo_mainLoop_function)(void); typedef struct { @@ -40,10 +75,21 @@ rodeo_rectangle_t; typedef struct { - uint8_t fill_this_out; + rodeo_texture_internal_p internal_texture; + uint32_t width; + uint32_t height; } rodeo_texture_2d_t; +/* +typedef struct +{ + rodeo_texture_2d_t texture; + rodeo_frameBuffer_internal_p internal_frame_buffer; +} +rodeo_frameBuffer_2d_t; +*/ + /// --- String --- // taken from STC library @@ -70,4 +116,4 @@ typedef void (*rodeo_log_function)(rodeo_string_t text); -typedef rodeo_texture_2d_t* rodeo_texture_2d_p; + |
