From 10a4efe35f6c47491b59e42c4f0e0b73bbe14c42 Mon Sep 17 00:00:00 2001 From: Fernando Raviola Date: Sun, 24 May 2020 02:22:07 -0300 Subject: [PATCH] Add Into scene, change font --- CMakeLists.txt | 1 + assets/font.ttf | Bin 11464 -> 19624 bytes include/Game.h | 1 + include/scenes/IntroScene.h | 11 ++++++++++ include/systems/RenderSystem.h | 8 ++++++- src/Game.cpp | 10 +++++---- src/scenes/EditorScene.cpp | 17 +++++++-------- src/scenes/IntroScene.cpp | 38 +++++++++++++++++++++++++++++++++ src/systems/RenderSystem.cpp | 8 ++++++- src/systems/ScoreSystem.cpp | 18 ++++++++-------- 10 files changed, 88 insertions(+), 24 deletions(-) create mode 100644 include/scenes/IntroScene.h create mode 100644 src/scenes/IntroScene.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c7babe0..fa5b8e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,6 +31,7 @@ add_executable(smb src/systems/ScoreSystem.cpp src/scenes/GameScene.cpp src/scenes/EditorScene.cpp + src/scenes/IntroScene.cpp ) diff --git a/assets/font.ttf b/assets/font.ttf index 408784e80fc7b3d57a13a829f5f26fc3959dd02b..6ce26eb4fc7a5e4ea01314bb5e19b76e94b3d7ec 100644 GIT binary patch literal 19624 zcmds9dz@WWbzbM*xpU`{WHOnMOx`zB0!1Vy0c=nVL7_!Jc^0rz$utZhmRG)mMu2VDxtZAM;BTL&X2cm>cKY4K8d?+mCsi82Z1U2F8{#J zC_zH7YEKEq^COO~)o@jNp(GiqffcCb(y*@-e#FBkB-nkH%{Spa*_7D!>+YE?QiWOyUo61ciBe!s{LL4*<0+3_V;$Pebl~S zH`xRBaeK)A!9E}Ef5on|YwW}J5xdo{w12US?Q*-!K4pJnpS4HrWA&EJC+u{)*9Povy9aUhHRO?R*u!>) z-Ea5V2D{Og*kkrd`?h_{{@Kp7N9_A{shwp@?ftggme~sXw5_xc*x9zqR@*tY#y)80 z+P~UbJKxT;Ker2Poqfsv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d~g!+ytg{OQ^o zBD+pu{9NSbyD%W%{WShG7yfRAzdexc`5p!^_by>zecwS0;P3l`$bPKvKaBxj2OvKH r{=l0UABo&{90T%$@PF`ij88=l!S|sR4A|Zd{tm%-9OHe#-y;7Tp{g## diff --git a/include/Game.h b/include/Game.h index eed3719..e9e76f2 100644 --- a/include/Game.h +++ b/include/Game.h @@ -6,6 +6,7 @@ #include "ecs/ecs.h" #include "scenes/GameScene.h" #include "scenes/EditorScene.h" +#include "scenes/IntroScene.h" #include "Constants.h" class Game { diff --git a/include/scenes/IntroScene.h b/include/scenes/IntroScene.h new file mode 100644 index 0000000..047e1ce --- /dev/null +++ b/include/scenes/IntroScene.h @@ -0,0 +1,11 @@ +#include "scenes/Scene.h" + +class IntroScene : public Scene { + +public: + IntroScene(SDL_Window* window); + +private: + void update() override; + +}; \ No newline at end of file diff --git a/include/systems/RenderSystem.h b/include/systems/RenderSystem.h index cb66228..bbc9294 100644 --- a/include/systems/RenderSystem.h +++ b/include/systems/RenderSystem.h @@ -17,6 +17,8 @@ class RenderSystem : public System { void onAddedToWorld(World* world) override; + void setBackgroundColor(int r, int g, int b); + void tick(World* world) override; void onRemovedFromWorld(World* world) override; @@ -35,5 +37,9 @@ class RenderSystem : public System { void renderText(std::vector entities); - TTF_Font * font; + TTF_Font* font; + + int r = SKY_RED; + int g = SKY_GREEN; + int b = SKY_BLUE; }; diff --git a/src/Game.cpp b/src/Game.cpp index 38a875b..0f8169a 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -1,8 +1,6 @@ #include "Game.h" -bool restartGame = false; - void Game::init(const char* title, int width, int height, bool fullscreen) { if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_AUDIO) != 0) { SDL_Log("Unable to initialize SDL: %s", SDL_GetError()); @@ -19,13 +17,17 @@ void Game::init(const char* title, int width, int height, bool fullscreen) { } isRunning = true; - currentScene = new GameScene(window); + currentScene = new IntroScene(window); } void Game::update() { currentScene->update(); - if (restartGame) {} + if (dynamic_cast(currentScene)) { + SDL_Delay(3000); + delete currentScene; + currentScene = new GameScene(window); + } } bool Game::running() const { return isRunning; } diff --git a/src/scenes/EditorScene.cpp b/src/scenes/EditorScene.cpp index abe189d..4c70561 100644 --- a/src/scenes/EditorScene.cpp +++ b/src/scenes/EditorScene.cpp @@ -8,29 +8,28 @@ EditorScene::EditorScene(SDL_Window* window) { world->registerSystem(new PhysicsSystem()); - //FIRST COLUMN (left aligned) auto title = world->create(); title->assign("MAP EDITOR MODE"); title->assign(10, 10, 60, 8); auto instructions1 = world->create(); - instructions1->assign("up down keys change tiles"); - instructions1->assign(10, 20, 80, 5); + instructions1->assign("- Press up/down keys to change tiles"); + instructions1->assign(10, 20, 92, 5); auto instructions2 = world->create(); - instructions2->assign("press keys a and d to pan camera"); - instructions2->assign(10, 26, 90, 5); + instructions2->assign("- Press keys 'a' and 'd' to pan camera"); + instructions2->assign(10, 26, 96, 5); auto instructions3 = world->create(); - instructions3->assign("press s to save the map to disk"); - instructions3->assign(10, 32, 86, 5); + instructions3->assign("- Press 's' to save the map to disk"); + instructions3->assign(10, 32, 90, 5); auto instructions4 = world->create(); - instructions4->assign("click to add and remove tiles"); + instructions4->assign("- Click to add and remove tiles"); instructions4->assign(10, 38, 80, 5); auto instructions5 = world->create(); - instructions5->assign("press e to exit the editor"); + instructions5->assign("- Press 'e' to exit the editor"); instructions5->assign(10, 44, 80, 5); } diff --git a/src/scenes/IntroScene.cpp b/src/scenes/IntroScene.cpp new file mode 100644 index 0000000..a7dfa29 --- /dev/null +++ b/src/scenes/IntroScene.cpp @@ -0,0 +1,38 @@ +#include "scenes/IntroScene.h" + +IntroScene::IntroScene(SDL_Window* window) { + world = new World(); + auto renderSystem = new RenderSystem(window, SNES_RESOLUTION_WIDTH, SNES_RESOLUTION_HEIGHT); + renderSystem->setBackgroundColor(0, 0, 0); + world->registerSystem(renderSystem); + world->registerSystem(new ScoreSystem()); + + auto worldName = world->create(); + worldName->assign("WORLD 1-1"); + auto width = 72; + worldName->assign(SNES_RESOLUTION_WIDTH / 2 - width / 2, + SNES_RESOLUTION_HEIGHT / 2 - 30, width, + 8); + + auto mario = world->create(); + mario->assign(TextureId::MARIO_STAND); + mario->assign(""); + mario->assign(SNES_RESOLUTION_WIDTH / 2 - TILE_SIZE / 2 - 20, SNES_RESOLUTION_HEIGHT / 2, + TILE_SIZE, + TILE_SIZE); + + auto x = world->create(); + x->assign("x"); + x->assign(SNES_RESOLUTION_WIDTH / 2 - 4, SNES_RESOLUTION_HEIGHT / 2 + 6, 8, 8); + + auto three = world->create(); + three->assign("3"); + three->assign(SNES_RESOLUTION_WIDTH / 2 - 4 + 20, SNES_RESOLUTION_HEIGHT / 2 + 6, 8, 8); +} + +void IntroScene::update() { + Scene::update(); + world->tick(); +} + + diff --git a/src/systems/RenderSystem.cpp b/src/systems/RenderSystem.cpp index 0ba34b5..b83cf4b 100644 --- a/src/systems/RenderSystem.cpp +++ b/src/systems/RenderSystem.cpp @@ -32,7 +32,7 @@ void RenderSystem::tick(World* world) { void RenderSystem::onAddedToWorld(World* world) { auto* entity = world->create(); - SDL_SetRenderDrawColor(renderer, SKY_RED, SKY_GREEN, SKY_BLUE, 255); + SDL_SetRenderDrawColor(renderer, r, g, b, 255); entity->assign(GAME_RESOLUTION_WIDTH / 2, GAME_RESOLUTION_HEIGHT / 2, GAME_RESOLUTION_WIDTH, @@ -110,3 +110,9 @@ void RenderSystem::renderText(std::vector entities) { SDL_RenderCopy(renderer, textComponent->texture, NULL, &dstRect); } } + +void RenderSystem::setBackgroundColor(int r, int g, int b) { + this->r = r; + this->g = g; + this->b = b; +} diff --git a/src/systems/ScoreSystem.cpp b/src/systems/ScoreSystem.cpp index fc5ac3d..e01096a 100644 --- a/src/systems/ScoreSystem.cpp +++ b/src/systems/ScoreSystem.cpp @@ -4,9 +4,9 @@ void ScoreSystem::onAddedToWorld(World* world) { System::onAddedToWorld(world); auto paddingH = 22; - auto paddingV = 12; - auto textHeight = 10; - auto spacingV = -3; + auto paddingV = 16; + auto textHeight = 8; + auto spacingV = -0; auto availableWidth = SNES_RESOLUTION_WIDTH - paddingH * 2; auto columns = 4; @@ -14,7 +14,7 @@ void ScoreSystem::onAddedToWorld(World* world) { //FIRST COLUMN (left aligned) auto marioEntity = world->create(); - marioEntity->assign("mario"); + marioEntity->assign("MARIO"); marioEntity->assign(paddingH, paddingV, 40, textHeight); scoreEntity = world->create(); @@ -42,25 +42,25 @@ void ScoreSystem::onAddedToWorld(World* world) { coinIco->assign(""); coinIco->assign( paddingH + columnWidth + (columnWidth - w) / 2 - 4, - paddingV + textHeight + spacingV + 1, 5, 8 + paddingV + textHeight + spacingV, 5, 8 ); // THIRD COLUMN (center aligned) auto worldEntity = world->create(); - worldEntity->assign("world"); + worldEntity->assign("WORLD"); w = 40; worldEntity->assign(paddingH + columnWidth * 2 + (columnWidth - w) / 2, paddingV, w, textHeight); auto worldNumberEntity = world->create(); - worldNumberEntity->assign("1 1"); - w = 20; + worldNumberEntity->assign("1-1"); + w = 24; worldNumberEntity->assign(paddingH + columnWidth * 2 + (columnWidth - w) / 2, paddingV + textHeight + spacingV, w, textHeight); // FOURTH COLUMN (right aligned) auto timeEntity = world->create(); - timeEntity->assign("time"); + timeEntity->assign("TIME"); timeEntity->assign(SNES_RESOLUTION_WIDTH - paddingH - 32, paddingV, 32, textHeight); timeLeftEntity = world->create();