void loading_scene_init() { strcpy(complete_credit_text, "Music by "); // Load names to credit. { platform_set_active_directory(binary_path); array files = array_create(sizeof(found_file)); array filters = string_split("AUTHOR.txt"); bool is_cancelled = false; platform_list_files_block(&files, "data/music/", filters, true, 0, true, &is_cancelled, 0); log_assert(files.length <= MAX_CREDITED_NAMES, "Not enough space for credited names."); for (s32 i = 0; i < files.length; i++) { found_file *file = array_at(&files, i); if (platform_file_exists(file->path)) { file_content name = platform_read_file_content(file->path, "rb"); if (name.file_error) continue; string_appendn(complete_credit_text, name.content, COMPLETE_CREDIT_LENGTH); if (i != files.length-1) { string_appendn(complete_credit_text, ", ", COMPLETE_CREDIT_LENGTH); } platform_destroy_file_content(&name); } mem_free(file->matched_filter); mem_free(file->path); } array_destroy(&files); array_destroy(&filters); } } void loading_scene_render(platform_window* window) { renderer->render_rectangle(area.x, area.y, area.w, area.h, COLOR_WHITE); font* font_reg = FONT_REGULAR(SIZE_RD(area.w, 36)); s32 target_size = area.h/5; s32 logo_text_pad = 20; s32 total_height = target_size + logo_text_pad + font_reg->px_h; s32 screen_center_x = area.x + (area.w/2); s32 screen_center_y = area.y + (area.h/2); s32 logo_x = screen_center_x - (target_size/2); s32 logo_y = screen_center_y - (total_height/2); //renderer->render_image(img_logo, logo_x, logo_y, target_size, target_size); s32 carwheel_size = area.w/4; static float rotation = 0.0f; rotation -= 0.5f*frame_delta; gl_render_set_rotation(rotation); renderer->render_image_tint(img_carwheel, screen_center_x - (carwheel_size/2), screen_center_y - (carwheel_size/2), carwheel_size, carwheel_size, COLOR_PANEL_BACKGROUND); gl_render_set_rotation(0.0f); // Credits font* font_s = FONT_REGULAR(SIZE_RD(area.w, 20)); s32 credit_pad = 30*scale; renderer->render_text(font_s, area.x + credit_pad, area.y+area.h-credit_pad-font_s->px_h, complete_credit_text, COLOR_TITLE); s32 text_y = area.y+area.h-credit_pad-font_s->px_h; char* company_name = "Developed by Aldrik Ramaekers"; s32 company_name_width = renderer->calculate_text_width(font_s, company_name); renderer->render_text(font_s, area.x + area.w - company_name_width - credit_pad, text_y, company_name, COLOR_TITLE); } void loading_scene_update(platform_window* window) { platform_set_cursor(window, CURSOR_LOADING); if (global_asset_collection.done_loading_assets) { game_set_active_scene(GAME_STATE_MENU); } } void loading_scene_destroy() { }