Parcourir la source

Add basic engine example

Patrick-Christopher Mattulat il y a 1 semaine
Parent
commit
6854068380
2 fichiers modifiés avec 45 ajouts et 0 suppressions
  1. 24 0
      cmake/ls-atlantis-example.cmake
  2. 21 0
      output/Example.cpp

+ 24 - 0
cmake/ls-atlantis-example.cmake

@@ -0,0 +1,24 @@
+################################################################
+################################################################
+# Example
+################################################################
+################################################################
+
+add_executable(ls-atlantis-example
+        ${CMAKE_CURRENT_SOURCE_DIR}/output/Example.cpp
+)
+
+target_link_libraries(ls-atlantis-example PRIVATE
+    ${MODULE_NAME_WINDOW}
+)
+
+if (WIN32)
+    add_custom_command(TARGET ls-atlantis-example POST_BUILD
+        COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:ls-atlantis-example>
+            $<TARGET_RUNTIME_DLLS:ls-atlantis-example>
+        COMMAND ${CMAKE_COMMAND} -E copy -t $<TARGET_FILE_DIR:ls-atlantis-example>
+            "$<$<CONFIG:Debug>:${LS_STD_DLLS_DEBUG}>"
+            "$<$<CONFIG:Release>:${LS_STD_DLLS_RELEASE}>"
+        COMMAND_EXPAND_LISTS
+    )
+endif ()

+ 21 - 0
output/Example.cpp

@@ -0,0 +1,21 @@
+/*
+ * author: Patrick-Christopher Mattulat
+ * e-mail: webmaster@lynarstudios.com
+ */
+
+#include <cycle/StatusCodes.hpp>
+#include <window/SdlWindowApi.hpp>
+
+using ls::atlantis::cycle::StatusCodes;
+using ls::atlantis::interfaces::AStatusCode;
+using ls::atlantis::window::SdlWindowApi;
+using ::std::make_shared;
+using ::std::shared_ptr;
+
+int main()
+{
+  const auto windowApi = make_shared<SdlWindowApi>();
+  const shared_ptr<AStatusCode> statusCode = windowApi->init();
+
+  return statusCode->getId() == StatusCodes::OK ? EXIT_SUCCESS : EXIT_FAILURE;
+}