summaryrefslogtreecommitdiff
path: root/src/scenes/error_scene.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-11-23 21:52:24 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-11-23 21:52:24 +0100
commit6f7374c2fa58c8692b51018864b802e6b876d305 (patch)
treea7e8ead757e9f4de1920395336dcac1c8a989576 /src/scenes/error_scene.c
A new start
Diffstat (limited to 'src/scenes/error_scene.c')
-rw-r--r--src/scenes/error_scene.c74
1 files changed, 74 insertions, 0 deletions
diff --git a/src/scenes/error_scene.c b/src/scenes/error_scene.c
new file mode 100644
index 0000000..8d4446a
--- /dev/null
+++ b/src/scenes/error_scene.c
@@ -0,0 +1,74 @@
+
+void error_scene_init()
+{
+
+}
+
+static void error_scene_draw_info(platform_window* window)
+{
+ s32 screen_center_x = area.x + (area.w/2);
+ s32 screen_center_y = area.y + (area.h/2);
+
+ float vertical_pad = 20 * scale;
+ float horizontal_pad = vertical_pad;
+ float spacing = 5 * scale;
+
+ s32 panel_h = 280 * scale;
+ s32 panel_item_size = (panel_h - (vertical_pad*2) - (spacing*1)) / 2;
+ s32 panel_w = (panel_item_size * 3) + (horizontal_pad*2) + (spacing*2);
+
+ s32 panel_x = screen_center_x - (panel_w/2);
+ s32 panel_y = screen_center_y - (panel_h/2);
+ panel_render(scale, panel_x, panel_y, panel_w, panel_h);
+
+ // info text
+ {
+ {
+ char* title = "ERROR";
+ font* font_title = FONT_REGULAR(SIZE_RD(area.w, 32));
+ s32 text_w = renderer->calculate_text_width(font_title, title);
+ s32 text_x = screen_center_x - (text_w/2);
+ s32 text_y = panel_y + (vertical_pad*2);
+ renderer->render_text(font_title, text_x+2, text_y+2, title, COLOR_TEXT_SHADOW);
+ renderer->render_text(font_title, text_x, text_y, title, COLOR_TEXT);
+ }
+ {
+ char* text = "An error occured, please verify\nyour game files.";
+ font* font_info = FONT_REGULAR(SIZE_RD(area.w, 28));
+ s32 text_w = panel_w - (horizontal_pad*4);
+ s32 text_x = screen_center_x - (text_w/2);
+ s32 text_y = screen_center_y - (font_info->px_h/2);
+ renderer->render_text_cutoff(font_info, text_x+2, text_y+2, text, COLOR_TEXT_SHADOW, 9999);
+ renderer->render_text_cutoff(font_info, text_x, text_y, text, COLOR_TEXT, 9999);
+ }
+
+ }
+
+ // back button
+ {
+ s32 back_h = img_back->height * scale/2;
+ s32 back_w = img_back->width * scale/2;
+ s32 back_x = panel_x + (panel_item_size/3);
+ s32 back_y = panel_y + panel_h - (back_h/2) - 1;
+
+ if (push_back_button(scale, back_x, back_y, back_w, back_h)) {
+ game_set_active_scene(GAME_STATE_MENU);
+ }
+ }
+}
+
+void error_scene_render(platform_window* window)
+{
+ menu_draw_background(window);
+ error_scene_draw_info(window);
+}
+
+void error_scene_update(platform_window* window)
+{
+
+}
+
+void error_scene_destroy()
+{
+
+} \ No newline at end of file