Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
AppSettings.h
Go to the documentation of this file.
1#pragma once
2
4
5#include <SDL/Option.h>
6#include <SDL/sdl_interface.h>
7#include <Common/primitive_type.h>
8#include <Math/TVector2.h>
9#include <Utility/TSpan.h>
10
11#include <string>
12
13namespace ph::editor
14{
15
16class AppSettings : public Option
17{
18public:
19 std::string title;
20 math::Vector2S displaySizePx;
21 uint32 maxFPS;
24
29 TSpanView<const char*> getCmdArgs();
30 void setCmdArgs(int argc, char* argv[]);
32
33private:
34 // Not tracked by SDL
35 TSpanView<const char*> m_cmdArgs;
36
37public:
38 PH_DEFINE_SDL_CLASS(TSdlOwnerClass<AppSettings>)
39 {
40 ClassType clazz("app-settings");
41 clazz.docName("Application Settings");
42 clazz.description("Settings for the application.");
43 clazz.baseOn<Option>();
44
45 TSdlString<OwnerType> title("title", &OwnerType::title);
46 title.description(
47 "Title of the application.");
48 title.defaultTo("Photon Editor");
49 clazz.addField(title);
50
51 TSdlVector2S<OwnerType> displaySizePx("display-size", &OwnerType::displaySizePx);
52 displaySizePx.description(
53 "Dimensions of the area for showing content.");
54 displaySizePx.defaultTo({0, 0});
55 clazz.addField(displaySizePx);
56
57 TSdlUInt32<OwnerType> maxFPS("max-fps", &OwnerType::maxFPS);
58 maxFPS.description(
59 "Maximum frames per second when displaying content.");
60 maxFPS.defaultTo(60);
61 clazz.addField(maxFPS);
62
63 TSdlEnumField<OwnerType, ghi::EGraphicsAPI> graphicsAPI("graphics-api", &OwnerType::graphicsAPI);
64 graphicsAPI.description(
65 "The hardware rendering API to use when displaying content.");
67 clazz.addField(graphicsAPI);
68
69 TSdlBool<OwnerType> useDebugModeGHI("use-debug-mode-ghi", &OwnerType::useDebugModeGHI);
70 useDebugModeGHI.description(
71 "Whether to use GHI with better debug ability. This kind of GHI, if supported, can "
72 "introduce extra overhead during runtime.");
73 useDebugModeGHI.defaultTo(false);
74 clazz.addField(useDebugModeGHI);
75
76 return clazz;
77 }
78};
79
80}// end namespace ph::editor
Definition AppSettings.h:17
PH_DEFINE_SDL_CLASS(TSdlOwnerClass< AppSettings >)
Definition AppSettings.h:38
bool useDebugModeGHI
Definition AppSettings.h:23
std::string title
Definition AppSettings.h:19
uint32 maxFPS
Definition AppSettings.h:21
void setCmdArgs(int argc, char *argv[])
Definition AppSettings.cpp:11
ghi::EGraphicsAPI graphicsAPI
Definition AppSettings.h:22
TSpanView< const char * > getCmdArgs()
Additional arguments passed from command line. Useful if some behavior want to be controlled/overridd...
Definition AppSettings.cpp:6
math::Vector2S displaySizePx
Definition AppSettings.h:20
EGraphicsAPI
Definition EGraphicsAPI.h:7
Definition ph_editor.h:10