VEX Engine
Retro looking game engine made in vulkan mostly because i wanted to understand it better.
Loading...
Searching...
No Matches
ProjectProperties.hpp
1
6
7#pragma once
8
9#include <ImReflect.hpp>
10#include <nlohmann/json.hpp>
11#include <string>
12#include <sstream>
13
15
17enum class WindowType { Windowed = 0, Borderless = 1, ExclusiveFullscreen = 2 };
18
20enum class DistributionCompressionLevel { VeryLow = 0, Low = 1, Medium = 2, High = 3, VeryHigh = 4, Extreme = 5 };
21
22// <store-level> - <asset archive size> / <launch time on ryzen 5 4650U>
23// raw - 1024MB / 1s | very low - 948MB / 3s | medium (default) - 933MB / 4s | extreme - 919MB / 6s
24
25inline void to_json(nlohmann::json& j, const DistributionCompressionLevel& level) {
26 j = static_cast<int>(level);
27}
28
29inline void from_json(const nlohmann::json& j, DistributionCompressionLevel& level) {
30 int value = 2;
31 if (j.is_number()) {
32 value = j.get<int>();
33 }
34 level = static_cast<DistributionCompressionLevel>(value);
35}
36
38 int major = 1;
39 int minor = 0;
40 int patch = 0;
41 auto operator<=>(const ProjectVersion&) const = default;
42};
43
44IMGUI_REFLECT(ProjectVersion, major, minor, patch);
45
46inline void to_json(nlohmann::json& j, const ProjectVersion& v) {
47 j = std::to_string(v.major) + "." + std::to_string(v.minor) + "." + std::to_string(v.patch);
48}
49
50inline void from_json(const nlohmann::json& j, ProjectVersion& v) {
51 std::string s;
52 if (j.is_string()) s = j.get<std::string>();
53 else if (j.is_number()) s = std::to_string(j.get<int>());
54
55 v.major = 0; v.minor = 0; v.patch = 0;
56 if (s.empty()) return;
57
58 std::stringstream ss(s);
59 std::string token;
60 int parts[3] = {0, 0, 0};
61 int i = 0;
62
63 while (std::getline(ss, token, '.') && i < 3) {
64 try { parts[i] = std::stoi(token); }
65 catch (...) { parts[i] = 0; }
66 if (parts[i] < 0) parts[i] = 0;
67 i++;
68 }
69 v.major = parts[0]; v.minor = parts[1]; v.patch = parts[2];
70}
71
74 std::string project_name = "NewVexProject";
75 std::string main_scene = "Assets/scenes/main.json";
76 std::string icon_path = "";
77 ProjectVersion version;
78
79 WindowType window_type = WindowType::Windowed;
81 bool vsync = true;
82 DistributionCompressionLevel distribution_compression = DistributionCompressionLevel::High;
83
84 auto operator<=>(const ProjectProperties&) const = default;
85};
86
87IMGUI_REFLECT(ProjectProperties, project_name, main_scene, icon_path, version, window_type, resolution_mode, vsync, distribution_compression);
88NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ProjectProperties, project_name, main_scene, icon_path, version, window_type, resolution_mode, vsync, distribution_compression);
This file defines ResolutionManager class and ResolutionMode struct.
ResolutionMode
Enumeration representing different resolution modes.
@ NATIVE
Use window resolution.
Structure to hold all configurable project settings and properties.