From 3f4e551a5ae270eb169109789f084a38cbf4c2a1 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 9 Jan 2024 12:27:54 +0100 Subject: [PATCH] NOw immediate and object base render can also be swapped with space in the main test GameScene. --- sfw/game_scene.cpp | 15 +++++++++++++-- sfw/game_scene.h | 4 +++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sfw/game_scene.cpp b/sfw/game_scene.cpp index ca3d91d..3909d97 100644 --- a/sfw/game_scene.cpp +++ b/sfw/game_scene.cpp @@ -32,6 +32,12 @@ void GameScene::input_event(const Ref &event) { right = pressed; } + if (k->get_physical_scancode() == KEY_SPACE) { + if (pressed) { + immediate = !immediate; + } + } + return; } @@ -69,8 +75,11 @@ void GameScene::update(float delta) { } void GameScene::render() { - //render_obj(); - render_immediate(); + if (!immediate) { + render_obj(); + } else { + render_immediate(); + } } void GameScene::render_immediate() { Renderer *r = Renderer::get_singleton(); @@ -157,6 +166,8 @@ void GameScene::render_obj() { } GameScene::GameScene() { + immediate = false; + left = false; right = false; up = false; diff --git a/sfw/game_scene.h b/sfw/game_scene.h index f237a6c..eb7f509 100644 --- a/sfw/game_scene.h +++ b/sfw/game_scene.h @@ -32,6 +32,8 @@ public: GameScene(); ~GameScene(); + bool immediate; + bool left; bool right; bool up; @@ -63,4 +65,4 @@ public: //ColoredMaterial *cmaterial; }; -#endif \ No newline at end of file +#endif