PixelBullet  0.0.1
A C++ game engine
Loading...
Searching...
No Matches
specification.h
1#pragma once
2
4
5#include <cstdint>
6#include <filesystem>
7#include <string>
8
9namespace pixelbullet
10{
16{
20 int count = 0;
21
25 char** args = nullptr;
26
33 const char* operator[](int index) const
34 {
35 ASSERT(index < count);
36 return args[index];
37 }
38};
39
40enum class ApplicationUtilityCommandKind
41{
42 None,
43 Help,
44 Pack
45};
46
48{
49 std::filesystem::path input_directory;
50 std::filesystem::path output_archive;
51 int compression_level = 3;
52};
53
55{
56 std::filesystem::path log_directory_override;
57 bool smoke_startup = false;
58 bool start_hidden = false;
59};
60
62{
63 ApplicationCommandLineArgs command_line_args;
64 std::string binary_path;
65 ApplicationLaunchOptions launch_options;
66 ApplicationUtilityCommandKind utility_command = ApplicationUtilityCommandKind::None;
68 std::string parse_error;
69
70 [[nodiscard]] bool HasParseError() const
71 {
72 return !parse_error.empty();
73 }
74};
75
81{
85 uint8_t major;
86
90 uint8_t minor;
91
95 uint8_t patch;
96
102 std::string ToString() const
103 {
104 return std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(patch);
105 }
106
112 uint32_t ToVulkanVersion() const;
113
120 bool operator==(const ApplicationVersion& other) const
121 {
122 return major == other.major && minor == other.minor && patch == other.patch;
123 }
124
131 bool operator!=(const ApplicationVersion& other) const
132 {
133 return !(*this == other);
134 }
135};
136
145{
146public:
150 std::string client_name;
151
155 uint32_t width;
156
160 uint32_t height;
161
165 std::string asset_base_path;
166
170 std::string icon_path;
171
176
187 const std::string engine_name;
188
193
195 : client_name("PixelBullet Game")
196 , width(1600)
197 , height(900)
198 , asset_base_path("")
199 , icon_path("")
200 , client_version{ 0, 0, 1 }
201 , engine_name("PixelBullet")
202 , engine_version{ PB_MODULE_VERSION_MAJOR, PB_MODULE_VERSION_MINOR, PB_MODULE_VERSION_PATCH }
203 {
204 }
205};
206
207} // namespace pixelbullet
Provides assertion and panic mechanisms with optional custom formatting.
#define ASSERT(condition,...)
Asserts that a condition is true.
Definition assert.h:163
Definition specification.h:62
Command-line arguments passed to the application.
Definition specification.h:16
char ** args
Pointer to an array of argument strings.
Definition specification.h:25
int count
The number of arguments.
Definition specification.h:20
const char * operator[](int index) const
Accesses an argument by index.
Definition specification.h:33
Definition specification.h:55
Definition specification.h:48
Contains configuration options for both the game and the engine.
Definition specification.h:145
std::string asset_base_path
The assets directory path.
Definition specification.h:165
const std::string engine_name
Default constructor that initializes default values.
Definition specification.h:187
uint32_t height
The window height.
Definition specification.h:160
const ApplicationVersion engine_version
The version of the engine (immutable).
Definition specification.h:192
uint32_t width
The window width.
Definition specification.h:155
std::string client_name
The name of the game or application.
Definition specification.h:150
ApplicationVersion client_version
The version for the game or application.
Definition specification.h:175
std::string icon_path
Optional application icon path.
Definition specification.h:170
Represents a version number.
Definition specification.h:81
bool operator!=(const ApplicationVersion &other) const
Compares two ApplicationVersion instances for inequality.
Definition specification.h:131
bool operator==(const ApplicationVersion &other) const
Compares two ApplicationVersion instances for equality.
Definition specification.h:120
std::string ToString() const
Converts the version to a string representation.
Definition specification.h:102
uint32_t ToVulkanVersion() const
Returns the Vulkan-compatible version integer.
Definition specification.cc:7
uint8_t patch
patch version number.
Definition specification.h:95
uint8_t minor
minor version number.
Definition specification.h:90
uint8_t major
major version number.
Definition specification.h:85