Prechádzať zdrojové kódy

Add engine parameter class

Patrick-Christopher Mattulat 6 dní pred
rodič
commit
b2873cc76e

+ 1 - 0
cmake/ls-atlantis-cycle-tests.cmake

@@ -10,6 +10,7 @@
 
 set(ATLANTIS_CYCLE_TEST_SOURCES
         ${CMAKE_CURRENT_SOURCE_DIR}/test/cycle/mock/WindowApiMock.cpp
+        ${CMAKE_CURRENT_SOURCE_DIR}/test/cycle/EngineParameterTest.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/test/cycle/EngineRuntimeDataTest.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/test/cycle/StatusCodeOkTest.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/test/cycle/StatusCodeWindowApiLoadingFailedTest.cpp

+ 1 - 0
cmake/ls-atlantis-cycle.cmake

@@ -9,6 +9,7 @@
 ################################
 
 set(ATLANTIS_CYCLE_SOURCES
+        ${CMAKE_CURRENT_SOURCE_DIR}/source/cycle/EngineParameter.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/cycle/EngineRuntimeData.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/cycle/StatusCodeOk.cpp
         ${CMAKE_CURRENT_SOURCE_DIR}/source/cycle/StatusCodeWindowApiLoadingFailed.cpp

+ 30 - 0
include/cycle/EngineParameter.hpp

@@ -0,0 +1,30 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#ifndef LS_ATLANTIS_ENGINE_CYCLE_ENGINE_PARAMETER_HPP
+#define LS_ATLANTIS_ENGINE_CYCLE_ENGINE_PARAMETER_HPP
+
+#include <Export.hpp>
+#include <glossary/WindowApiTypes.hpp>
+
+namespace ls::atlantis::cycle
+{
+  class LS_ATLANTIS_DYNAMIC_GOAL EngineParameter
+  {
+    public:
+
+      EngineParameter();
+      ~EngineParameter();
+
+      [[nodiscard]] ls::atlantis::glossary::WindowApiTypes getWindowApiType() const;
+      void setWindowApiType(const ls::atlantis::glossary::WindowApiTypes &_windowApiType);
+
+    private:
+
+      ls::atlantis::glossary::WindowApiTypes windowApiType{};
+  };
+}
+
+#endif

+ 23 - 0
source/cycle/EngineParameter.cpp

@@ -0,0 +1,23 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <cycle/EngineParameter.hpp>
+
+using ls::atlantis::cycle::EngineParameter;
+using ls::atlantis::glossary::WindowApiTypes;
+
+EngineParameter::EngineParameter() = default;
+
+EngineParameter::~EngineParameter() = default;
+
+WindowApiTypes EngineParameter::getWindowApiType() const
+{
+  return this->windowApiType;
+}
+
+void EngineParameter::setWindowApiType(const WindowApiTypes &_windowApiType)
+{
+  this->windowApiType = _windowApiType;
+}

+ 36 - 0
test/cycle/EngineParameterTest.cpp

@@ -0,0 +1,36 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <cycle/EngineParameter.hpp>
+#include <glossary/WindowApiTypes.hpp>
+#include <gtest/gtest.h>
+
+using ls::atlantis::cycle::EngineParameter;
+using ls::atlantis::glossary::WindowApiTypes;
+using ::testing::Test;
+
+namespace
+{
+  class EngineParameterTest : public Test
+  {
+    public:
+
+      EngineParameterTest() = default;
+      ~EngineParameterTest() override = default;
+  };
+
+  TEST_F(EngineParameterTest, getWindowApiType_default)
+  {
+    ASSERT_EQ(WindowApiTypes::NONE_SELECTED, EngineParameter().getWindowApiType());
+  }
+
+  TEST_F(EngineParameterTest, setWindowApiType)
+  {
+    EngineParameter engineParameter{};
+    engineParameter.setWindowApiType(WindowApiTypes::SDL_WINDOW_API);
+
+    ASSERT_EQ(WindowApiTypes::SDL_WINDOW_API, engineParameter.getWindowApiType());
+  }
+}