From 0c0512b37f972fab001cf1750545f4bf3fb2a64c Mon Sep 17 00:00:00 2001 From: Foxar Date: Thu, 10 Dec 2020 14:38:12 +0100 Subject: [PATCH] Added: Game over screen --- src/samples/dolphin/dolphin.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/samples/dolphin/dolphin.cpp b/src/samples/dolphin/dolphin.cpp index cf506a6..782b529 100755 --- a/src/samples/dolphin/dolphin.cpp +++ b/src/samples/dolphin/dolphin.cpp @@ -56,6 +56,11 @@ void Dolphin::onInit() island.shouldBeBackfaceCulled = true; island.shouldBeFrustumCulled = false; + gameOver.size.set(640.0F, 480.0F); + Texture *gameOverTex = texRepo->add("2d/", "gameover", PNG); + gameOver.setMode(MODE_STRETCH); + gameOverTex->addLink(gameOver.getId()); + printf("Loading water overlay...\n"); waterOverlay.size.set(640.0F, 480.0F); Texture *watOverlayTex = texRepo->add("2d/", "underwater_overlay", PNG); @@ -147,7 +152,14 @@ void Dolphin::onInit() void Dolphin::onUpdate() { - + if (player.getLifes() <= 0) + { + engine->audio.stopSong(); + engine->audio.setADPCMVolume(0, 0); + engine->audio.setADPCMVolume(75, 1); + engine->renderer->draw(gameOver); + return; + } Dolphin::engineFPS = engine->fps; if (engine->pad.isCrossClicked) printf("Delta multiplier: %f\n", 60.0F / engine->fps);