diff --git a/scenes/options_scene.c b/scenes/options_scene.c index 1afc68a..a3446c8 100644 --- a/scenes/options_scene.c +++ b/scenes/options_scene.c @@ -50,62 +50,76 @@ static void options_scene_render_func(Scene_t* scene) KeyBindInfo_t keybind_info; char buffer[64]; - int y_offset = 16; + int y_offset = 32; uint16_t line = 0; + Sprite_t* level_board = get_sprite(&scene->engine->assets, "lvl_board"); +#define TITLE_FONT_SIZE 40 +#define FONT_SIZE 24 +#define FONT_COLOUR BLACK + float start_x = scene->engine->intended_window_size.x / 2; + start_x -= level_board->frame_size.x / 2; + Font* menu_font = get_font(&scene->engine->assets, "MenuFont"); + BeginTextureMode(scene->layers.render_layers[0].layer_tex); - ClearBackground((Color){0,0,0,0}); + ClearBackground((Color){0,0,0,0}); + draw_sprite(level_board, 0, (Vector2){start_x,0},0, false); + Vector2 title_size = MeasureTextEx(*menu_font, "Options", TITLE_FONT_SIZE, 4); + DrawTextEx(*menu_font, "Options", (Vector2){start_x + title_size.x/2,y_offset}, TITLE_FONT_SIZE, 4, BLACK); + y_offset += TITLE_FONT_SIZE; - if (line == data->curr_selection) - { - DrawText(">>", 0, y_offset, 12, WHITE); - } - float vol = GetMasterVolume(); - sprintf(buffer, "Volume : %.1f", vol); - DrawText(buffer, 32, y_offset, 12, WHITE); - y_offset += 12; - line++; - - sc_array_foreach(&data->keybinds_info, keybind_info) { + start_x += 32; if (line == data->curr_selection) { - DrawText(">>", 0, y_offset, 12, WHITE); + DrawTextEx(*menu_font, ">>", (Vector2){start_x,y_offset}, FONT_SIZE, 4, BLACK); } - if (keybind_info.key == keybind_info.original_key) - { - sprintf(buffer, "%s : %s", keybind_info.action_name, keybind_info.key_name); - DrawText(buffer, 32, y_offset, 12, WHITE); - } - else - { - sprintf(buffer, "%s : %s => %s", keybind_info.action_name, keybind_info.original_key_name, keybind_info.key_name); - DrawText(buffer, 32, y_offset, 12, BLUE); - } - y_offset += 12; + float vol = GetMasterVolume(); + sprintf(buffer, "Volume : %.1f", vol); + DrawTextEx(*menu_font, buffer, (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLACK); + y_offset += FONT_SIZE; line++; - } - if (line == data->curr_selection) - { - DrawText(">>", 0, y_offset, 12, WHITE); - } - DrawText("Apply", 32, y_offset, 12, WHITE); - y_offset += 12; - line++; + sc_array_foreach(&data->keybinds_info, keybind_info) { + if (line == data->curr_selection) + { + DrawTextEx(*menu_font, ">>", (Vector2){start_x,y_offset}, FONT_SIZE, 4, BLACK); + } + if (keybind_info.key == keybind_info.original_key) + { + sprintf(buffer, "%s : %s", keybind_info.action_name, keybind_info.key_name); + DrawTextEx(*menu_font, buffer, (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLACK); + } + else + { + sprintf(buffer, "%s : %s => %s", keybind_info.action_name, keybind_info.original_key_name, keybind_info.key_name); + DrawTextEx(*menu_font, buffer, (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLUE); + } + y_offset += FONT_SIZE; + line++; + } - if (line == data->curr_selection) - { - DrawText(">>", 0, y_offset, 12, WHITE); - } - DrawText("Return", 32, y_offset, 12, WHITE); - y_offset += 12; - line++; + y_offset += FONT_SIZE; + if (line == data->curr_selection) + { + DrawTextEx(*menu_font, ">>", (Vector2){start_x, y_offset}, FONT_SIZE, 4, BLACK); + } + DrawTextEx(*menu_font, "Apply", (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLACK); + y_offset += FONT_SIZE; + line++; - if (data->mode == OPTIONS_KEYBIND_MODE) - { - y_offset += 36; - DrawText("Press a Key...", 32, y_offset, 12, WHITE); - } + if (line == data->curr_selection) + { + DrawTextEx(*menu_font, ">>", (Vector2){start_x,y_offset}, FONT_SIZE, 4, BLACK); + } + DrawTextEx(*menu_font, "Return", (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLACK); + y_offset += FONT_SIZE; + line++; + + if (data->mode == OPTIONS_KEYBIND_MODE) + { + y_offset += FONT_SIZE; + DrawTextEx(*menu_font, "Press a Key...", (Vector2){start_x+32, y_offset}, FONT_SIZE, 4, BLACK); + } EndTextureMode(); } @@ -149,7 +163,6 @@ static void wait_for_keymap_input(Scene_t* scene) static void exec_component_function(Scene_t* scene, uint16_t sel) { OptionSceneData_t* data = &(CONTAINER_OF(scene, OptionScene_t, scene)->data); - printf("Sel: %u\n", sel); if (sel == 0) { // Volume option, does nothing @@ -166,7 +179,6 @@ static void exec_component_function(Scene_t* scene, uint16_t sel) sel -= n_binds; if (sel == 0) { - printf("Keybind ready\n"); // OK will propagate to the engine KeyBindInfo_t info; sc_array_foreach(&data->keybinds_info, info)