summaryrefslogtreecommitdiffhomepage
path: root/src/menu.c
diff options
context:
space:
mode:
authorrealtradam <[email protected]>2023-06-05 04:41:51 -0400
committerrealtradam <[email protected]>2023-06-05 04:41:51 -0400
commitd40893aa03f75d68c8770823b9eb96847dd16426 (patch)
tree46ca8536378f7d14086609a95671166a0d0243be /src/menu.c
parent8d1a2e890f132175feae0c817b5f8c4848a81bf1 (diff)
downloadrodeo_sample_game-d40893aa03f75d68c8770823b9eb96847dd16426.tar.gz
rodeo_sample_game-d40893aa03f75d68c8770823b9eb96847dd16426.zip
begin rewriting rodeo kit to avoid exposed pointers
Diffstat (limited to 'src/menu.c')
-rw-r--r--src/menu.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/menu.c b/src/menu.c
index 868fbfd..003de89 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -4,9 +4,9 @@
#include "player.h"
#include "rodeo.h"
-rodeo_texture_2d_t splash_texture;
-rodeo_texture_2d_t main_menu_texture;
-rodeo_texture_2d_t gameover_texture;
+rodeo_gfx_texture_2d_t splash_texture;
+rodeo_gfx_texture_2d_t main_menu_texture;
+rodeo_gfx_texture_2d_t gameover_texture;
menu_state_t menu_state;
float splash_timer;
rodeo_rectangle_t screen_dimensions = (rodeo_rectangle_t){.x = 0, .y = 0, .width = 1600, .height = 900};
@@ -14,9 +14,9 @@ rodeo_rectangle_t screen_dimensions = (rodeo_rectangle_t){.x = 0, .y = 0, .width
void
init_menu(void)
{
- splash_texture = rodeo_texture_2d_create_from_path(cstr_lit("assets/splash.png"));
- main_menu_texture = rodeo_texture_2d_create_from_path(cstr_lit("assets/main_menu.png"));
- gameover_texture = rodeo_texture_2d_create_from_path(cstr_lit("assets/restart_menu.png"));
+ splash_texture = rodeo_gfx_texture_2d_create_from_path(cstr_lit("assets/splash.png"));
+ main_menu_texture = rodeo_gfx_texture_2d_create_from_path(cstr_lit("assets/main_menu.png"));
+ gameover_texture = rodeo_gfx_texture_2d_create_from_path(cstr_lit("assets/restart_menu.png"));
menu_state = menu_state_main;
splash_timer = 3000.0f;
@@ -26,9 +26,9 @@ init_menu(void)
void
deinit_menu(void)
{
- rodeo_texture_2d_destroy(&splash_texture);
- rodeo_texture_2d_destroy(&main_menu_texture);
- rodeo_texture_2d_destroy(&gameover_texture);
+ rodeo_gfx_texture_2d_destroy(splash_texture);
+ rodeo_gfx_texture_2d_destroy(main_menu_texture);
+ rodeo_gfx_texture_2d_destroy(gameover_texture);
}
void
@@ -37,12 +37,12 @@ draw_menu(void)
float transparency = 0.65f;
if (splash_timer > 0 && menu_state == menu_state_splash)
{
- splash_timer -= rodeo_frame_time_get();
- rodeo_texture_2d_draw(
- &screen_dimensions,
- &screen_dimensions,
- NULL,
- &splash_texture
+ splash_timer -= rodeo_gfx_frame_time_get();
+ rodeo_gfx_texture_2d_draw(
+ screen_dimensions,
+ screen_dimensions,
+ (rodeo_color_RGBAFloat_t){.array = {1,1,1,1}},
+ splash_texture
);
if (splash_timer <= 0) {
menu_state = menu_state_main;
@@ -51,32 +51,32 @@ draw_menu(void)
else if (menu_state == menu_state_main)
{
- rodeo_texture_2d_draw(
- &screen_dimensions,
- &screen_dimensions,
- &(rodeo_color_RGBAFloat_t){ .array = { 0,0,0,transparency }},
- NULL
+ rodeo_gfx_texture_2d_draw(
+ screen_dimensions,
+ screen_dimensions,
+ (rodeo_color_RGBAFloat_t){ .array = { 0,0,0,transparency }},
+ (rodeo_gfx_texture_2d_t){0}
);
- rodeo_texture_2d_draw(
- &screen_dimensions,
- &screen_dimensions,
- NULL,
- &main_menu_texture
+ rodeo_gfx_texture_2d_draw(
+ screen_dimensions,
+ screen_dimensions,
+ (rodeo_color_RGBAFloat_t){.array = {1,1,1,1}},
+ main_menu_texture
);
}
else if (menu_state == menu_state_gameover)
{
- rodeo_texture_2d_draw(
- &screen_dimensions,
- &screen_dimensions,
- &(rodeo_color_RGBAFloat_t){ .array = { 0,0,0,transparency }},
- NULL
+ rodeo_gfx_texture_2d_draw(
+ screen_dimensions,
+ screen_dimensions,
+ (rodeo_color_RGBAFloat_t){ .array = { 0,0,0,transparency }},
+ (rodeo_gfx_texture_2d_t){0}
);
- rodeo_texture_2d_draw(
- &screen_dimensions,
- &screen_dimensions,
- NULL,
- &gameover_texture
+ rodeo_gfx_texture_2d_draw(
+ screen_dimensions,
+ screen_dimensions,
+ (rodeo_color_RGBAFloat_t){.array = {1,1,1,1}},
+ gameover_texture
);
}
}