Skip to content

Commit e2fadae

Browse files
Splitting Editor and Game application from the engine (#463)
* engine reshaped part 1 * engine refactored - second part * engine reshaped - part 3 * engine reshaped - part 4 * fixed compile issues * re-enabled render scene * fixed hashmap literal char * fixed load texture from asset manager * fixed on window minimize crash * updated postbuild * ensured waiting for pbelisk * fixed * fixed crash on loading model * fixed nullptr on reading keyboard device
1 parent 39f4817 commit e2fadae

File tree

93 files changed

+2940
-2847
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+2940
-2847
lines changed

CMakeLists.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ if (NOT LAUNCHER_ONLY)
7474
# Editor is here
7575
#
7676
add_subdirectory (Tetragrama)
77+
78+
# Entry point is here
79+
#
80+
add_subdirectory (Obelisk)
7781
endif ()
7882

7983
# Launcher is here
@@ -105,7 +109,7 @@ add_custom_target (AssembleContent ALL
105109
)
106110

107111
if (NOT LAUNCHER_ONLY)
108-
add_dependencies(AssembleContent zEngineLib tetragrama)
112+
add_dependencies(AssembleContent zEngineLib tetragrama Obelisk)
109113
endif ()
110114

111115
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")

Obelisk/CMakeLists.txt

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
cmake_minimum_required (VERSION 3.17)
2+
3+
project (Obelisk
4+
VERSION 1.0
5+
DESCRIPTION "Obelisk, The game application entry point"
6+
LANGUAGES CXX
7+
)
8+
9+
set (CMAKE_CXX_STANDARD_REQUIRED ON)
10+
set (CMAKE_CXX_STANDARD 20)
11+
12+
set (TARGET_NAME Obelisk)
13+
14+
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
15+
add_executable (${TARGET_NAME} WIN32)
16+
else()
17+
add_executable (${TARGET_NAME})
18+
endif()
19+
20+
target_sources(${TARGET_NAME} PUBLIC EntryPoint.cpp)
21+
22+
# We set this debugger directory to find assets and resources file
23+
# after being copied to Debug and Release output directories
24+
#
25+
if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
26+
set_target_properties(${TARGET_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "$(ProjectDir)$(Configuration)")
27+
endif ()
28+
29+
include(${EXTERNAL_DIR}/externals.cmake)
30+
31+
target_include_directories (${TARGET_NAME}
32+
PRIVATE
33+
.
34+
${ENLISTMENT_ROOT}
35+
${ENLISTMENT_ROOT}/ZEngine
36+
)
37+
38+
target_precompile_headers(${TARGET_NAME} PRIVATE pch.h)
39+
40+
target_compile_definitions(${TARGET_NAME}
41+
PRIVATE
42+
NOMINMAX
43+
UNICODE
44+
_UNICODE
45+
)
46+
47+
target_link_libraries(${TARGET_NAME} PRIVATE
48+
zEngineLib
49+
tetragrama
50+
imported::External_obeliskLibs
51+
)

Tetragrama/EntryPoint.cpp renamed to Obelisk/EntryPoint.cpp

Lines changed: 31 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,54 @@
33
#include <ZEngine/Core/Memory/MemoryManager.h>
44
#include <ZEngine/EngineConfiguration.h>
55
#include <ZEngine/Logging/Logger.h>
6-
#include "Editor.h"
6+
#include <ZEngine/Applications/GameApplication.h>
7+
8+
#include <Tetragrama/Editor.h>
79

810
#ifdef ZENGINE_PLATFORM
911

1012
using namespace ZEngine;
1113
using namespace ZEngine::Logging;
1214
using namespace ZEngine::Core::Memory;
15+
using namespace ZEngine::Applications;
1316

1417
int applicationEntryPoint(int argc, char* argv[])
1518
{
16-
CLI::App app{"ZEngine Editor"};
17-
argv = app.ensure_utf8(argv);
18-
19-
std::string editor_cfg_file{""};
20-
app.add_option("--projectConfigFile", editor_cfg_file, "The project config file");
21-
22-
CLI11_PARSE(app, argc, argv);
23-
2419
MemoryManager manager = {};
25-
MemoryConfiguration config = {.DefaultSize = ZGiga(2u)};
20+
MemoryConfiguration config = {.DefaultSize = ZGiga(3u)};
2621
manager.Initialize(config);
2722
auto arena = &(manager.ArenaAllocator);
2823

2924
LoggerConfiguration logger_cfg = {};
3025
Logger::Initialize(arena, logger_cfg);
3126

32-
auto editor = ZPushStruct(arena, Tetragrama::Editor);
33-
editor->Initialize(arena, editor_cfg_file.c_str());
34-
editor->Run();
3527

36-
editor->Dispose();
28+
GameApplicationPtr app = nullptr;
29+
30+
31+
CLI::App cli{"ObeliskCLI"};
32+
argv = cli.ensure_utf8(argv);
33+
34+
std::string config_file = "";
35+
bool launch_editor = false;
36+
cli.add_option("--projectConfigFile", config_file, "The project config file");
37+
cli.add_option("--launchEditor", launch_editor, "The project config file");
38+
39+
CLI11_PARSE(cli, argc, argv);
40+
41+
42+
if (launch_editor)
43+
{
44+
app = ZPushStructCtor(arena, Tetragrama::Editor);
45+
app->EnableRenderOverlay = true;
46+
}
47+
48+
app->ConfigFile = config_file.c_str();
49+
50+
app->Initialize(arena);
51+
app->Run();
52+
app->Shutdown();
53+
3754
Logger::Dispose();
3855

3956
manager.Shutdowm();

Obelisk/pch.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#include <pch.h>

Obelisk/pch.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#pragma once
2+
#include <algorithm>
3+
#include <cctype>
4+
#include <chrono>
5+
#include <cstring>
6+
#include <filesystem>
7+
#include <fstream>
8+
#include <functional>
9+
#include <iostream>
10+
#include <memory>
11+
#include <regex>
12+
#include <span>
13+
#include <stack>
14+
#include <string>
15+
#include <string_view>
16+
#include <unordered_map>
17+
#include <utility>
18+
#include <vector>

Panzerfaust/Service/EngineService.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,24 @@ public class EngineService : IEngineService
1313
string _enginePath = string.Empty;
1414
string _workingDirectory = string.Empty;
1515

16-
const string _editorAppName = "zEngineEditor";
16+
const string _launcherCLIAppName = "Obelisk";
1717
const string _configJsonFilename = "projectConfig.json";
18-
const string _engineCommandLineArgs = "--projectConfigFile";
18+
const string _projectFileCommandLineArgs = "--projectConfigFile";
19+
const string _editorCommandLineArgs = "--launchEditor 1";
1920

2021
public EngineService()
2122
{
2223
string engineExtension = string.Empty;
2324
#if _WIN32
2425
engineExtension = ".exe";
2526
#endif
26-
_enginePath = Path.Combine(Environment.CurrentDirectory, "Editor", $"{_editorAppName}{engineExtension}");
27+
_enginePath = Path.Combine(Environment.CurrentDirectory, "Editor", $"{_launcherCLIAppName}{engineExtension}");
2728
_workingDirectory = Path.Combine(Environment.CurrentDirectory, "Editor");
2829
}
2930

3031
public async Task StartAsync(string path)
3132
{
32-
List<string> engineArgs = new() { _engineCommandLineArgs, Path.Combine(path, _configJsonFilename) };
33+
List<string> engineArgs = new() { _editorCommandLineArgs, _projectFileCommandLineArgs, Path.Combine(path, _configJsonFilename) };
3334

3435
var processStartInfo = new ProcessStartInfo(_enginePath, string.Join(" ", engineArgs))
3536
{

Scripts/PostBuild.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,16 @@ $ContentsToProcess = @(
6161
Contents = @(
6262
switch ($SystemName) {
6363
"Windows" {
64-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Shaders"}
65-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Settings"}
64+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
65+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
6666
}
6767
"Darwin" {
68-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Shaders"}
69-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\$Configurations\Settings"}
68+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Shaders"}
69+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\$Configurations\Settings"}
7070
}
7171
"Linux" {
72-
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Tetragrama\Shaders"}
73-
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Tetragrama\Settings"}
72+
@{ From = "$RepoRoot\Resources\Shaders"; To = "$OuputBuildDirectory\Obelisk\Shaders"}
73+
@{ From = "$RepoRoot\Resources\Editor\Settings"; To = "$OuputBuildDirectory\Obelisk\Settings"}
7474
}
7575
Default {
7676
throw 'This system is not supported'
@@ -79,31 +79,31 @@ $ContentsToProcess = @(
7979
)
8080
},
8181
@{
82-
Name = "Tetragrama"
82+
Name = "Obelisk"
8383
IsDirectory = $true
8484
Contents = @(
8585
switch ($SystemName) {
8686
"Windows" {
87-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
88-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
87+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
88+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
8989
}
9090
"Darwin" {
9191
switch ($Architectures) {
9292
"osx-x64" {
93-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
94-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
93+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
94+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
9595
}
9696
"osx-arm64" {
97-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
98-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
97+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\Editor"}
98+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\$Architectures\publish\Editor"}
9999
}
100100
Default {
101101
throw 'This architecture is not supported'
102102
}
103103
}
104104
}
105105
"Linux" {
106-
@{ From = "$OuputBuildDirectory\Tetragrama\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
106+
@{ From = "$OuputBuildDirectory\Obelisk\$Configurations"; To = "$OuputBuildDirectory\Panzerfaust\$Configurations\$TargetFramework\Editor"}
107107
}
108108
Default {
109109
throw 'This system is not supported'

Tetragrama/CMakeLists.txt

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,7 @@ source_group (TREE ${PROJECT_SOURCE_DIR} PREFIX "Source Files" FILES ${HEADER_FI
1616

1717
set (TARGET_NAME tetragrama)
1818

19-
if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
20-
add_executable (${TARGET_NAME} WIN32)
21-
else()
22-
add_executable (${TARGET_NAME})
23-
endif()
19+
add_library (${TARGET_NAME})
2420

2521
target_sources(${TARGET_NAME} PUBLIC ${HEADER_FILES} ${CPP_FILES})
2622

@@ -34,7 +30,7 @@ endif ()
3430
include(${EXTERNAL_DIR}/externals.cmake)
3531

3632
target_include_directories (${TARGET_NAME}
37-
PRIVATE
33+
PUBLIC
3834
.
3935
./Components
4036
./Components/Events
@@ -50,16 +46,12 @@ target_include_directories (${TARGET_NAME}
5046
)
5147

5248
target_precompile_headers(${TARGET_NAME} PRIVATE pch.h)
49+
5350
target_compile_definitions(${TARGET_NAME}
5451
PRIVATE
5552
NOMINMAX
5653
UNICODE
5754
_UNICODE
5855
)
5956

60-
target_link_libraries(${TARGET_NAME} PRIVATE
61-
zEngineLib
62-
imported::External_editorLibs
63-
)
64-
65-
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME "zEngineEditor")
57+
target_link_libraries(${TARGET_NAME} PRIVATE zEngineLib)

0 commit comments

Comments
 (0)