Browse Source

Add basic status code layout

Patrick-Christopher Mattulat 1 tuần trước cách đây
mục cha
commit
fa51c59b82

+ 1 - 0
.gitignore

@@ -1 +1,2 @@
 .idea
+CMakeUserPresets.json

+ 65 - 0
CMakeLists.txt

@@ -0,0 +1,65 @@
+cmake_minimum_required(VERSION 3.28)
+project(ls-atlantis-engine VERSION 0.0.1 LANGUAGES CXX)
+
+set(CMAKE_CONFIGURATION_TYPES "Debug" CACHE STRING "Build configurations" FORCE)
+
+################################
+# Compiler Settings
+################################
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_EXTENSIONS OFF)
+
+################################
+# Global Project Settings
+################################
+
+set(MODULE_NAME_CORE ls-atlantis-core)
+
+include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
+
+################################
+# Dependencies
+################################
+
+find_package(GTest REQUIRED)
+
+################################
+# Source Files: Core Module
+################################
+
+set(ATLANTIS_CORE_SOURCES
+    ${CMAKE_CURRENT_SOURCE_DIR}/source/IWindowApi.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/source/StatusCode.cpp
+)
+
+################################
+# Library Creation: Core Module
+################################
+
+add_library(${MODULE_NAME_CORE} SHARED ${ATLANTIS_CORE_SOURCES})
+
+################################
+# Test Files: Core Module
+################################
+
+set(ATLANTIS_CORE_TEST_SOURCES
+    ${CMAKE_CURRENT_SOURCE_DIR}/test/core/StatusCodeTest.cpp
+)
+
+################################
+# Test Case Creation: Core Module
+################################
+
+enable_testing()
+
+add_executable(atlantis-core-tests ${ATLANTIS_CORE_TEST_SOURCES})
+
+target_link_libraries(atlantis-core-tests PRIVATE
+    ${MODULE_NAME_CORE}
+    GTest::gtest_main
+)
+
+include(GoogleTest)
+gtest_discover_tests(atlantis-core-tests)

+ 15 - 2
README.md

@@ -1,10 +1,23 @@
 # Atlantis Game Engine
 
-This is a 2D game engine based on SDL3. 
+This is a 3D game engine based on SDL3 + Vulkan API / Metal API. 
+
+## Prerequisites
+
+The following prerequisites need to be fulfilled in order to build this game engine.
+
+1. Conan 2.29.1 must be installed.
+2. A Conan default profile must exist with the same compiler flags as this project.
+3. Missing Conan dependencies must be installed:
+```shell
+conan install . --output-folder=cmake-build-debug --build=missing -s build_type=Debug -s compiler.cppstd=17
+conan install . --output-folder=cmake-build-release --build=missing -s build_type=Release -s compiler.cppstd=17
+```
+4. To Do
 
 ## Modules
 
-It contains the following modules:
+In Process: It contains the following modules:
 
 | Name                  | Description                                                                                              |
 |-----------------------|----------------------------------------------------------------------------------------------------------|

+ 6 - 0
conanfile.txt

@@ -0,0 +1,6 @@
+[requires]
+gtest/1.17.0
+
+[generators]
+CMakeDeps
+CMakeToolchain

+ 18 - 0
include/Export.hpp

@@ -0,0 +1,18 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#ifndef LS_ATLANTIS_ENGINE_EXPORT_HPP
+#define LS_ATLANTIS_ENGINE_EXPORT_HPP
+
+#if defined(_WIN32) && defined(_MSC_VER)
+  #define LS_ATLANTIS_DLL_EXPORT __declspec(dllexport)
+  #define LS_ATLANTIS_DLL_IMPORT __declspec(dllimport)
+  #define LS_ATLANTIS_DYNAMIC_GOAL LS_ATLANTIS_DLL_EXPORT
+#endif
+#if defined(unix) || defined(__APPLE__) || defined(_WIN32) && defined(__GNUC__)
+  #define LS_ATLANTIS_DYNAMIC_GOAL
+#endif
+
+#endif

+ 0 - 3
include/README.md

@@ -1,3 +0,0 @@
-# Include Directory
-
-In this directory all libraries include files will be stored.

+ 24 - 0
include/core/IWindowApi.hpp

@@ -0,0 +1,24 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#ifndef LS_ATLANTIS_ENGINE_CORE_I_WINDOW_API_HPP
+#define LS_ATLANTIS_ENGINE_CORE_I_WINDOW_API_HPP
+
+#include "StatusCode.hpp"
+
+namespace ls::atlantis::core::interfaces
+{
+  class IWindowApi
+  {
+    public:
+
+      IWindowApi();
+      virtual ~IWindowApi();
+
+      virtual StatusCode init() = 0;
+  };
+}
+
+#endif

+ 31 - 0
include/core/StatusCode.hpp

@@ -0,0 +1,31 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#ifndef LS_ATLANTIS_ENGINE_CORE_STATUS_CODE_HPP
+#define LS_ATLANTIS_ENGINE_CORE_STATUS_CODE_HPP
+
+#include <Export.hpp>
+#include <string>
+
+namespace ls::atlantis::core
+{
+  class LS_ATLANTIS_DYNAMIC_GOAL StatusCode
+  {
+    public:
+
+      explicit StatusCode(const uint16_t &_statusId, ::std::string _statusText);
+      ~StatusCode();
+
+      [[nodiscard]] uint16_t getId() const;
+      [[nodiscard]] ::std::string getText() const;
+
+    private:
+
+      uint16_t statusId{};
+      ::std::string statusText{};
+  };
+}
+
+#endif

+ 12 - 0
source/IWindowApi.cpp

@@ -0,0 +1,12 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <core/IWindowApi.hpp>
+
+using ls::atlantis::core::interfaces::IWindowApi;
+
+IWindowApi::IWindowApi() = default;
+
+IWindowApi::~IWindowApi() = default;

+ 0 - 3
source/README.md

@@ -1,3 +0,0 @@
-# Source Directory
-
-In this directory all libraries source files will be stored.

+ 25 - 0
source/StatusCode.cpp

@@ -0,0 +1,25 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <core/StatusCode.hpp>
+
+using ls::atlantis::core::StatusCode;
+using ::std::move;
+using ::std::string;
+
+StatusCode::StatusCode(const uint16_t &_statusId, string _statusText) : statusId(_statusId), statusText(::move(_statusText))
+{}
+
+StatusCode::~StatusCode() = default;
+
+uint16_t StatusCode::getId() const
+{
+  return this->statusId;
+}
+
+string StatusCode::getText() const
+{
+  return this->statusText;
+}

+ 32 - 0
test/core/StatusCodeTest.cpp

@@ -0,0 +1,32 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <core/StatusCode.hpp>
+#include <gtest/gtest.h>
+
+using ls::atlantis::core::StatusCode;
+using ::std::string;
+using ::testing::Test;
+
+namespace
+{
+  class StatusCodeTest : public Test
+  {
+    public:
+
+      StatusCodeTest() = default;
+      ~StatusCodeTest() override = default;
+  };
+
+  TEST_F(StatusCodeTest, getId)
+  {
+    ASSERT_EQ(42, StatusCode(42, "ok").getId());
+  }
+
+  TEST_F(StatusCodeTest, getText)
+  {
+    ASSERT_EQ(string("ok"), StatusCode(42, "ok").getText());
+  }
+}