From b91b9f37684954ecb5e22347f994c4650ccc3e27 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sat, 26 Dec 2020 17:20:05 +0100 Subject: [PATCH] Platform/PlatformApplication: adding create() method. --- engine.build.lua | 1 + source/Platform/PlatformApplication.cpp | 21 +++++++++++++++++++++ source/Platform/PlatformApplication.h | 2 ++ 3 files changed, 24 insertions(+) create mode 100644 source/Platform/PlatformApplication.cpp diff --git a/engine.build.lua b/engine.build.lua index ffce57e..82f6200 100644 --- a/engine.build.lua +++ b/engine.build.lua @@ -52,6 +52,7 @@ local system_module = Module("source/System", { }) local platform_common_module = Module("source/Platform", { + "PlatformApplication.cpp", "PlatformDisplay.cpp" }) diff --git a/source/Platform/PlatformApplication.cpp b/source/Platform/PlatformApplication.cpp new file mode 100644 index 0000000..02076a0 --- /dev/null +++ b/source/Platform/PlatformApplication.cpp @@ -0,0 +1,21 @@ + +#include "PlatformApplication.h" + +#ifdef _WIN32 +#include +typedef sp::Win32Application ApplicationType; +#elif defined(__linux__) || defined(unix) || defined(__unix) || defined(__unix__) +#include +typedef sp::UnixApplication ApplicationType; +#else +#error "No Application implementation exists" +#endif + +namespace sp { + +PlatformApplication* PlatformApplication::create() +{ + return new ApplicationType; +} + +} // namespace sp diff --git a/source/Platform/PlatformApplication.h b/source/Platform/PlatformApplication.h index 800bf31..d094ca3 100644 --- a/source/Platform/PlatformApplication.h +++ b/source/Platform/PlatformApplication.h @@ -11,6 +11,8 @@ class MessageQueue; class PlatformApplication { public : + static PlatformApplication* create(); + virtual void init() = 0; virtual void shutdown() = 0;