From bb055a48d214b6697b57db03a9f7e4300178c585 Mon Sep 17 00:00:00 2001 From: Lauchmelder Date: Fri, 14 Jan 2022 22:11:27 +0100 Subject: [PATCH] Added layer system --- CMakeLists.txt | 4 +++- include/lol/Layer.hpp | 27 +++++++++++++++++++++++++++ include/lol/lol.hpp | 3 ++- src/Layer.cpp | 17 +++++++++++++++++ 4 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 include/lol/Layer.hpp create mode 100644 src/Layer.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bf3c1d..acf11f9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,9 @@ add_library(lol STATIC "src/buffers/VertexBuffer.cpp" "src/buffers/ElementBuffer.cpp" "src/Image.cpp" - "src/ObjectManager.cpp") + "src/ObjectManager.cpp" + "src/Layer.cpp" +) target_include_directories(lol PUBLIC ${GLM_INCLUDE_DIRS} diff --git a/include/lol/Layer.hpp b/include/lol/Layer.hpp new file mode 100644 index 0000000..af7509f --- /dev/null +++ b/include/lol/Layer.hpp @@ -0,0 +1,27 @@ +#pragma once + +#include + +namespace lol +{ + class CameraBase; + + class Layer + { + public: + Layer(const std::string& debugName); + virtual ~Layer(); + + virtual void OnAttach() {} + virtual void OnDetach() {} + + virtual void OnUpdate() {} + virtual void OnRender(CameraBase& camera) {} + + inline const std::string& GetDebugName() { return debugName; } + + private: + std::string debugName; + }; + +} \ No newline at end of file diff --git a/include/lol/lol.hpp b/include/lol/lol.hpp index cf1a9a4..4dff9d6 100644 --- a/include/lol/lol.hpp +++ b/include/lol/lol.hpp @@ -7,4 +7,5 @@ #include #include #include -#include \ No newline at end of file +#include +#include \ No newline at end of file diff --git a/src/Layer.cpp b/src/Layer.cpp new file mode 100644 index 0000000..c7d6321 --- /dev/null +++ b/src/Layer.cpp @@ -0,0 +1,17 @@ +#include + +#include + +namespace lol +{ + Layer::Layer(const std::string& debugName) : + debugName(debugName) + { + + } + + Layer::~Layer() + { + + } +} \ No newline at end of file