Load a level for graphics on title screen

This commit is contained in:
Edgaru089 2024-04-28 19:59:16 +08:00
parent 2fd8e669c5
commit 437ad8c4b0
4 changed files with 15 additions and 7 deletions

1
app.c
View File

@ -43,6 +43,7 @@ App *app_NewApp() {
app->wantQuit = false; app->wantQuit = false;
app->paused = false; app->paused = false;
app_QueueLoadLevel(app, "title.txt");
return app; return app;
} }

View File

@ -140,8 +140,6 @@ void misc_thinker_ChangeLevel(App *app, Entity *e, Duration deltaTime) {
e->thinker = NULL; e->thinker = NULL;
return; return;
} }
if (app->player->player == NULL) // No player
return;
// Copied from Hazard thinker // Copied from Hazard thinker
uint64_t emitCooldown = 400.0 * 60000.0 / e->misc->trigger.size.x; // 60 msec across 400px uint64_t emitCooldown = 400.0 * 60000.0 / e->misc->trigger.size.x; // 60 msec across 400px
@ -164,6 +162,10 @@ void misc_thinker_ChangeLevel(App *app, Entity *e, Duration deltaTime) {
20, duration_FromSeconds(0), &render_ModeDefault); 20, duration_FromSeconds(0), &render_ModeDefault);
e->thinkerData = (void *)lastEmit.microseconds; e->thinkerData = (void *)lastEmit.microseconds;
} }
if (app->player->player == NULL) // No player
return;
Component_Player *p = app->player->player; Component_Player *p = app->player->player;
Box2 playerbox = physics_HitboxAbsolute(p->super->hitbox); Box2 playerbox = physics_HitboxAbsolute(p->super->hitbox);

9
title.txt Normal file
View File

@ -0,0 +1,9 @@
CUTOFF 1500
BACKGROUND 40 40 40
PUT_CAMERA 0 0
HAZARD -590 -250 200 100
LEVEL_TRANSITION 350 100 200 100 intro.txt
FILL 0 0 0 -590 -250 200 1000
FILL 255 255 255 350 100 200 500
FILL 20 20 20 -219 152 184 488
TEXTBOX -206 79 65 78 info_plate_small_2 safa

View File

@ -24,11 +24,7 @@ static void _ui_Action_ReturnToTitle(System_UI *sys, ui_Part *part, uintptr_t da
WARN("new state stack is now empty, ohno"); WARN("new state stack is now empty, ohno");
sys->super->clear_color = RGB(40, 40, 40); sys->super->clear_color = RGB(40, 40, 40);
// Clear the app app_QueueLoadLevel(sys->super, "title.txt");
// see app_file.c:233
entity_Clear(sys->super->entity);
particle_Clear(sys->super->particle);
sys->super->camera->target = NULL;
} }
static void _ui_Action_SelectLevel(System_UI *sys, ui_Part *part, uintptr_t data) { static void _ui_Action_SelectLevel(System_UI *sys, ui_Part *part, uintptr_t data) {
while (vector_Size(sys->state) > 0 && ui_CurrentState(sys) != ui_TitleMenu) { while (vector_Size(sys->state) > 0 && ui_CurrentState(sys) != ui_TitleMenu) {