summaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/rodeo.h107
-rw-r--r--include/rodeo/audio.h15
-rw-r--r--include/rodeo/gfx.h98
-rw-r--r--include/rodeo/gfx_t.h66
-rw-r--r--include/rodeo/input.h2
-rw-r--r--include/rodeo/window.h50
-rw-r--r--include/rodeo_types.h61
7 files changed, 230 insertions, 169 deletions
diff --git a/include/rodeo.h b/include/rodeo.h
index a9dae49..f60d527 100644
--- a/include/rodeo.h
+++ b/include/rodeo.h
@@ -7,6 +7,8 @@
#include "rodeo/common.h"
#include "rodeo/audio.h"
#include "rodeo/collision.h"
+#include "rodeo/gfx.h"
+#include "rodeo/window.h"
// -- external --
#include "stc/cstr.h"
@@ -38,116 +40,11 @@ rodeo_random_uint64_get(void);
/// --- Core ---
-#define \
-mrodeo_window_do( \
- screen_height, \
- screen_width, \
- title \
-) \
- mrodeo_defer_do( \
- rodeo_window_init( \
- screen_height, \
- screen_width, \
- title \
- ), \
- rodeo_window_deinit() \
- )
-
-void
-rodeo_window_init(
- uint16_t screen_height,
- uint16_t screen_width,
- cstr title
-);
-
-void
-rodeo_window_deinit(void);
-
-uint16_t
-rodeo_screen_width_get(void);
-
-uint16_t
-rodeo_screen_height_get(void);
-
-#define \
-mrodeo_frame_do( \
- state \
-) \
- mrodeo_defer_do( \
- rodeo_frame_begin(state), \
- rodeo_frame_end(state) \
- )
-
-void
-rodeo_frame_begin(void);
-
-void
-rodeo_frame_end(void);
-
void
rodeo_mainLoop_run(
rodeo_mainLoop_function main_loop_func
);
-bool
-rodeo_window_quit_get(void);
-
-void
-rodeo_window_quit_set(bool quit);
-
void
rodeo_debug_text_draw(uint16_t x, uint16_t y, const char *format, ...);
-cstr
-rodeo_renderer_name_get(void);
-
-void
-rodeo_renderer_flush(void);
-
-const rodeo_texture_2d_t*
-rodeo_texture_2d_default_get(void);
-
-rodeo_texture_2d_t
-rodeo_texture_2d_create_from_RGBA8(
- const uint16_t width,
- const uint16_t height,
- const uint8_t memory[]
-);
-
-rodeo_texture_2d_t
-rodeo_texture_2d_create_from_path(cstr path);
-
-void
-rodeo_texture_2d_destroy(rodeo_texture_2d_t *texture);
-
-void
-rodeo_rectangle_draw(
- const rodeo_rectangle_t *rectangle,
- const rodeo_color_RGBAFloat_t *color
-);
-
-void
-rodeo_texture_2d_draw(
- const rodeo_rectangle_t *destination,
- const rodeo_rectangle_t *source,
- const rodeo_color_RGBAFloat_t *color,
- const rodeo_texture_2d_t *texture
-);
-
-
-/// --- Framerate ---
-
-uint64_t
-rodeo_frame_count_get(void);
-
-float
-rodeo_frame_time_get(void);
-
-float
-rodeo_frame_perSecond_get(void);
-
-void
-rodeo_frame_limit_set(uint32_t limit);
-
-uint32_t
-rodeo_frame_limit_get(void);
diff --git a/include/rodeo/audio.h b/include/rodeo/audio.h
index dd7639d..14ae6f0 100644
--- a/include/rodeo/audio.h
+++ b/include/rodeo/audio.h
@@ -10,14 +10,25 @@ typedef struct rodeo_audio_sound_t rodeo_audio_sound_t;
typedef struct rodeo_audio_music_t rodeo_audio_music_t;
void
-rodeo_audio_initialize(
+rodeo_audio_init(
uint32_t channels
//uint32_t num_sound_pools,
//uint32_t size_sound_pools
);
void
-rodeo_audio_deinitialize(void);
+rodeo_audio_deinit(void);
+
+#define \
+mrodeo_audio_do( \
+ channels \
+) \
+ mrodeo_defer_do( \
+ rodeo_audio_init( \
+ channels \
+ ), \
+ rodeo_audio_deinit() \
+ )
/*
uint32_t
diff --git a/include/rodeo/gfx.h b/include/rodeo/gfx.h
new file mode 100644
index 0000000..28d46ff
--- /dev/null
+++ b/include/rodeo/gfx.h
@@ -0,0 +1,98 @@
+#pragma once
+
+// -- internal --
+// public
+#include "rodeo/gfx_t.h"
+
+// -- external --
+#include "stc/cstr.h"
+
+void
+rodeo_gfx_init(void);
+
+void
+rodeo_gfx_deinit(void);
+
+void
+rodeo_gfx_frame_begin(void);
+
+void
+rodeo_gfx_frame_end(void);
+
+cstr
+rodeo_gfx_renderer_name_get(void);
+
+void
+rodeo_gfx_renderer_flush(void);
+
+const rodeo_gfx_texture_2d_t*
+rodeo_gfx_texture_2d_default_get(void);
+
+rodeo_gfx_texture_2d_t
+rodeo_gfx_texture_2d_create_from_RGBA8(
+ const uint16_t width,
+ const uint16_t height,
+ const uint8_t memory[]
+);
+
+rodeo_gfx_texture_2d_t
+rodeo_gfx_texture_2d_create_from_path(cstr path);
+
+void
+rodeo_gfx_texture_2d_destroy(rodeo_gfx_texture_2d_t *texture);
+
+void
+rodeo_gfx_rectangle_draw(
+ const rodeo_rectangle_t *rectangle,
+ const rodeo_color_RGBAFloat_t *color
+);
+
+void
+rodeo_gfx_texture_2d_draw(
+ const rodeo_rectangle_t *destination,
+ const rodeo_rectangle_t *source,
+ const rodeo_color_RGBAFloat_t *color,
+ const rodeo_gfx_texture_2d_t *texture
+);
+
+void
+rodeo_gfx_renderer_flush(void);
+
+uint32_t
+rodeo_gfx_frame_limit_get(void);
+
+cstr
+rodeo_gfx_renderer_name_get(void);
+
+uint64_t
+rodeo_gfx_frame_count_get(void);
+
+float
+rodeo_gfx_frame_time_get(void);
+
+float
+rodeo_gfx_frame_perSecond_get(void);
+
+void
+rodeo_gfx_frame_limit_set(uint32_t limit);
+
+uint32_t
+rodeo_gfx_frame_limit_get(void);
+
+#define \
+mrodeo_gfx_do( \
+) \
+ mrodeo_defer_do( \
+ rodeo_gfx_init(), \
+ rodeo_gfx_deinit() \
+ )
+
+
+#define \
+mrodeo_gfx_frame_do( \
+) \
+ mrodeo_defer_do( \
+ rodeo_gfx_frame_begin(), \
+ rodeo_gfx_frame_end() \
+ )
+
diff --git a/include/rodeo/gfx_t.h b/include/rodeo/gfx_t.h
new file mode 100644
index 0000000..9ed5f14
--- /dev/null
+++ b/include/rodeo/gfx_t.h
@@ -0,0 +1,66 @@
+#pragma once
+
+// -- internal --
+// public
+#include "rodeo_types.h"
+// -- system --
+#include <inttypes.h>
+
+typedef struct irodeo_gfx_texture_internal irodeo_gfx_texture_internal_t;
+
+typedef
+struct
+{
+ irodeo_gfx_texture_internal_t *internal_texture;
+ uint32_t width;
+ uint32_t height;
+}
+rodeo_gfx_texture_2d_t;
+
+typedef
+union
+{
+ struct
+ {
+ float red;
+ float green;
+ float blue;
+ float alpha;
+ }
+ colors;
+ float array[4];
+}
+rodeo_color_RGBAFloat_t;
+
+typedef
+union
+{
+ struct
+ {
+ uint8_t red;
+ uint8_t green;
+ uint8_t blue;
+ uint8_t alpha;
+ }
+ colors;
+ uint32_t rgba;
+ uint8_t array[4];
+}
+rodeo_color_RGBA8_t;
+
+typedef
+struct
+{
+ float x;
+ float y;
+ float z;
+ rodeo_color_RGBAFloat_t color;
+ //float red;
+ //float green;
+ //float blue;
+ //float alpha;
+ float texture_x;
+ float texture_y;
+ float texture_id;
+}
+rodeo_gfx_vertex_t;
diff --git a/include/rodeo/input.h b/include/rodeo/input.h
index 690d2d1..fe2b67d 100644
--- a/include/rodeo/input.h
+++ b/include/rodeo/input.h
@@ -4,7 +4,7 @@
#include "rodeo/input_t.h"
bool
-rodeo_input_events_poll(void);
+rodeo_input_poll(void);
void
rodeo_input_command_register_callback(
diff --git a/include/rodeo/window.h b/include/rodeo/window.h
new file mode 100644
index 0000000..dd505f2
--- /dev/null
+++ b/include/rodeo/window.h
@@ -0,0 +1,50 @@
+#pragma once
+
+// -- internal --
+// public
+//#include "rodeo/window_t.h"
+
+// -- external --
+#include "stc/cstr.h"
+
+// -- system --
+#include <inttypes.h>
+
+
+void
+rodeo_window_init(
+ uint16_t screen_height,
+ uint16_t screen_width,
+ cstr title
+);
+
+void
+rodeo_window_deinit(void);
+
+uint16_t
+rodeo_window_screen_width_get(void);
+
+uint16_t
+rodeo_window_screen_height_get(void);
+
+bool
+rodeo_window_shouldQuit(void);
+
+void
+rodeo_window_quit(void);
+
+#define \
+mrodeo_window_do( \
+ screen_height, \
+ screen_width, \
+ title \
+) \
+ mrodeo_defer_do( \
+ rodeo_window_init( \
+ screen_height, \
+ screen_width, \
+ title \
+ ), \
+ rodeo_window_deinit() \
+ )
+
diff --git a/include/rodeo_types.h b/include/rodeo_types.h
index f3c81fa..3763611 100644
--- a/include/rodeo_types.h
+++ b/include/rodeo_types.h
@@ -8,58 +8,6 @@
#include <stdint.h>
#include <stddef.h>
-typedef struct irodeo_texture_internal_t irodeo_texture_internal_t;
-typedef irodeo_texture_internal_t *rodeo_texture_internal_p;
-
-typedef
-union
-{
- struct
- {
- float red;
- float green;
- float blue;
- float alpha;
- }
- colors;
- float array[4];
-}
-rodeo_color_RGBAFloat_t;
-
-typedef
-union
-{
- struct
- {
- uint8_t red;
- uint8_t green;
- uint8_t blue;
- uint8_t alpha;
- }
- colors;
- uint32_t rgba;
- uint8_t array[4];
-}
-rodeo_color_RGBA8_t;
-
-
-typedef
-struct
-{
- float x;
- float y;
- float z;
- rodeo_color_RGBAFloat_t color;
- //float red;
- //float green;
- //float blue;
- //float alpha;
- float texture_x;
- float texture_y;
- float texture_id;
-}
-rodeo_vertex_t;
-
typedef
void
(*rodeo_mainLoop_function)(void);
@@ -74,15 +22,6 @@ struct
}
rodeo_rectangle_t;
-typedef
-struct
-{
- rodeo_texture_internal_p internal_texture;
- uint32_t width;
- uint32_t height;
-}
-rodeo_texture_2d_t;
-
/*
typedef struct
{