From 1febd4f365700f6b31aea86194d8118347c2b303 Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Fri, 22 Apr 2022 20:07:18 +0100
Subject: [PATCH] clean up app makefile - remove unused scene interface

---
 fggl/CMakeLists.txt   | 80 +++++++++++++++++++++++--------------------
 fggl/scenes/Scene.cpp | 25 --------------
 fggl/scenes/Scene.h   | 53 ----------------------------
 fggl/scenes/menu.cpp  |  4 ---
 4 files changed, 42 insertions(+), 120 deletions(-)
 delete mode 100644 fggl/scenes/Scene.cpp
 delete mode 100644 fggl/scenes/Scene.h

diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt
index fbcb32f..e5c5f08 100644
--- a/fggl/CMakeLists.txt
+++ b/fggl/CMakeLists.txt
@@ -1,25 +1,25 @@
 
 # headers
-file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/fggl/**.hpp" )
+file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/fggl/**.hpp")
 
 # the fggl library itself
 add_library(fggl ${HEADER_LIST})
 
 # we need to tell people using the library about our headers
-target_include_directories( fggl
-	PUBLIC
-	  $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
-	  $<INSTALL_INTERFACE:include>
-)
+target_include_directories(fggl
+        PUBLIC
+        $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
+        $<INSTALL_INTERFACE:include>
+        )
 
 # users of this library need at least C++17
-target_compile_features( fggl PUBLIC cxx_std_17 )
+target_compile_features(fggl PUBLIC cxx_std_17)
 
 # IDE support for nice header files
 source_group(
-	TREE "${PROJECT_SOURCE_DIR}/include"
-	PREFIX "Header Files"
-	FILES ${HEADER_LIST}
+        TREE "${PROJECT_SOURCE_DIR}/include"
+        PREFIX "Header Files"
+        FILES ${HEADER_LIST}
 )
 
 # Generation of configuration header
@@ -27,40 +27,44 @@ configure_file(FgglConfig.h.in FgglConfig.h)
 
 # clang tidy
 find_program(CLANG_TIDY_FOUND clang-tidy)
-if ( CLANG_TIDY_FOUND )
-	set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=*,-llvmlibc-*,-fuchsia-*,-cppcoreguidelines-*,-android-*,-llvm-*,-altera-*,-modernize-use-trailing-return-type)
-endif()
+if (CLANG_TIDY_FOUND)
+    set(CMAKE_CXX_CLANG_TIDY clang-tidy -checks=*,-llvmlibc-*,-fuchsia-*,-cppcoreguidelines-*,-android-*,-llvm-*,-altera-*,-modernize-use-trailing-return-type)
+endif ()
 
 target_sources(${PROJECT_NAME}
-  PRIVATE
-    app.cpp
-    ecs/ecs.cpp
-    data/model.cpp
-    data/procedural.cpp
-    data/heightmap.cpp
-    ecs3/fast/Container.cpp
-    ecs3/prototype/world.cpp
-    scenes/Scene.cpp
-    scenes/menu.cpp
-    ecs3/module/module.cpp
-    input/camera_input.cpp
-    input/input.cpp
-    input/mouse.cpp
-    data/heightmap.cpp
-	gui/widget.cpp
-	gui/widgets.cpp
-	gui/containers.cpp
-	gui/fonts.cpp
-	math/triangulation.cpp
-	math/shapes.cpp
-)
+        PRIVATE
+        app.cpp
+
+        data/model.cpp
+        data/procedural.cpp
+        data/heightmap.cpp
+
+        ecs/ecs.cpp
+        ecs3/module/module.cpp
+        ecs3/fast/Container.cpp
+        ecs3/prototype/world.cpp
+
+        scenes/menu.cpp
+
+        input/input.cpp
+        input/mouse.cpp
+        input/camera_input.cpp
+
+        gui/widget.cpp
+        gui/widgets.cpp
+        gui/containers.cpp
+        gui/fonts.cpp
+
+        math/triangulation.cpp
+        math/shapes.cpp
+        )
 
 # spdlog for cleaner logging
-find_package( spdlog )
+find_package(spdlog)
 target_link_libraries(${PROJECT_NAME} PRIVATE spdlog::spdlog)
 
-find_package( freetype )
-target_link_libraries(${PROJECT_NAME} PUBLIC freetype )
+find_package(freetype)
+target_link_libraries(${PROJECT_NAME} PUBLIC freetype)
 
 # Graphics backend
 add_subdirectory(gfx)
diff --git a/fggl/scenes/Scene.cpp b/fggl/scenes/Scene.cpp
deleted file mode 100644
index b3d2dab..0000000
--- a/fggl/scenes/Scene.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
-//
-// Created by webpigeon on 20/11/2021.
-//
-
-#include "Scene.h"
-
-#include <utility>
-
-namespace fggl::scenes {
-
-    void SceneManager::create(const std::string &name, std::shared_ptr<Scene> scene) {
-        m_scenes[name] = std::move(scene);
-    }
-
-    void SceneManager::activate(const std::string &name) {
-        auto newScene = m_scenes.at(name);
-        if ( m_active != nullptr ) {
-            m_active->cleanup();
-            m_active = nullptr;
-        }
-        newScene->setup();
-        m_active = newScene;
-    }
-
-}
\ No newline at end of file
diff --git a/fggl/scenes/Scene.h b/fggl/scenes/Scene.h
deleted file mode 100644
index b749d91..0000000
--- a/fggl/scenes/Scene.h
+++ /dev/null
@@ -1,53 +0,0 @@
-//
-// Created by webpigeon on 20/11/2021.
-//
-
-#ifndef FGGL_SCENE_H
-#define FGGL_SCENE_H
-
-#include <memory>
-#include <string>
-#include <unordered_map>
-
-namespace fggl::scenes {
-
-    class Scene {
-        public:
-            virtual ~Scene() = default;
-            
-            // no copying
-            Scene(const Scene&) = delete;
-            Scene& operator=(const Scene&) = delete;
-
-            virtual void setup() = 0;
-            virtual void cleanup() = 0;
-
-            virtual void update() = 0;
-            virtual void render() = 0;
-    };
-
-    class SceneManager {
-        public:
-            SceneManager() = default;
-
-            void create(const std::string& name, std::shared_ptr<Scene> scene);
-            void activate(const std::string& name);
-
-            inline void update() {
-                if ( m_active == nullptr ) { return; }
-                m_active->update();
-            }
-
-            inline void render() {
-                if ( m_active == nullptr ) { return; }
-                m_active->render();
-            }
-
-        private:
-            std::shared_ptr<Scene> m_active;
-            std::unordered_map<std::string, std::shared_ptr<Scene>> m_scenes;
-    };
-
-}
-
-#endif //FGGL_SCENE_H
diff --git a/fggl/scenes/menu.cpp b/fggl/scenes/menu.cpp
index 712056f..b0437c3 100644
--- a/fggl/scenes/menu.cpp
+++ b/fggl/scenes/menu.cpp
@@ -14,10 +14,6 @@ namespace fggl::scenes {
     BasicMenu::BasicMenu(fggl::App& app) : AppState(app), m_inputs(nullptr), m_active(), m_hover(nullptr) {
         auto& locator = fggl::util::ServiceLocator::instance();
         m_inputs = locator.get<input::Input>();
-
-		math::vec2 pos{ 500.F, 500.F };
-		math::vec2 size{ 32.5F, 35.F };
-		m_canvas.add(std::make_unique<gui::Button>(pos, size));
     }
 
     void BasicMenu::update() {
-- 
GitLab