Skip to content

Commit 510f689

Browse files
committed
🔨 Update example program
1 parent ef937ef commit 510f689

File tree

1 file changed

+23
-16
lines changed

1 file changed

+23
-16
lines changed

src/game/main.cpp

+23-16
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,10 @@ int main(int argc, char *argv[]) {
8686

8787
// Load a texture
8888
ste::AssetHandle<ste::Texture> textureHandle;
89-
try {
90-
textureHandle = assetManager->load<ste::Texture>(
91-
ste::getAssetPath("textures/albert.png"));
92-
if (!textureHandle) {
93-
std::cerr << "Failed to load texture" << std::endl;
94-
return -1;
95-
}
96-
} catch (const std::exception &e) {
97-
std::cerr << "Failed to load texture: " << e.what() << std::endl;
89+
textureHandle = assetManager->load<ste::Texture>(
90+
ste::getAssetPath("textures/albert.png"));
91+
if (!textureHandle) {
92+
std::cerr << "Failed to load texture" << std::endl;
9893
return -1;
9994
}
10095

@@ -204,21 +199,33 @@ int main(int argc, char *argv[]) {
204199

205200
switch (event.key.keysym.sym) {
206201
case SDLK_1:
207-
timeScale->targetScale = 0.72f;
208-
audioEngine.setSpeed(0.72f);
209-
if (timeScale->currentScale != 0.72f)
202+
timeScale->targetScale = 0.66f;
203+
audioEngine.setSpeed(0.66f);
204+
if (timeScale->currentScale != 0.66f)
210205
audioEngine.playSound(slowDown);
211206
break;
212207
case SDLK_2:
208+
timeScale->targetScale = 0.90f;
209+
audioEngine.setSpeed(0.90f);
210+
if (timeScale->currentScale != 0.90f)
211+
audioEngine.playSound(slowDown);
212+
break;
213+
case SDLK_3:
213214
timeScale->targetScale = 1.0f;
214215
audioEngine.setSpeed(1.0f);
215216
if (timeScale->currentScale != 1.0f)
216217
audioEngine.playSound(slowDown);
217218
break;
218-
case SDLK_3:
219-
timeScale->targetScale = 1.68f;
220-
audioEngine.setSpeed(1.68f);
221-
if (timeScale->currentScale != 1.68f)
219+
case SDLK_4:
220+
timeScale->targetScale = 1.25f;
221+
audioEngine.setSpeed(1.25f);
222+
if (timeScale->currentScale != 1.25f)
223+
audioEngine.playSound(slowDown);
224+
break;
225+
case SDLK_5:
226+
timeScale->targetScale = 1.55f;
227+
audioEngine.setSpeed(1.55f);
228+
if (timeScale->currentScale != 1.55f)
222229
audioEngine.playSound(slowDown);
223230
break;
224231
case SDLK_SPACE:

0 commit comments

Comments
 (0)