#include <AppDefine.h>
Definition at line 48 of file AppDefine.h.
◆ AppDef()
DLLEXPORT Leviathan::AppDef::AppDef |
( |
const bool & |
isdef = false | ) |
|
Definition at line 15 of file AppDefine.cpp.
std::unique_ptr< NamedVars > ConfigurationValues
static AppDef * Defaultconf
◆ ~AppDef()
Definition at line 28 of file AppDefine.cpp.
KeyConfiguration * _KeyConfiguration
GameConfiguration * _GameConfiguration
#define SAFE_RELEASEDEL(x)
static AppDef * Defaultconf
◆ FillDefaultEngineConf()
This is called then the engine config file isn't found to fill the options with default values.
This is also used to fill existing configs with missing values
- Returns
- True if options need to be saved (changes were made)
Definition at line 193 of file AppDefine.cpp.
195 bool changed =
false;
199 variables.
Add(std::make_shared<NamedVariableList>(
"Vsync",
false));
205 std::make_shared<NamedVariableList>(
"FullScreen",
new StringBlock(
"no")));
210 variables.
Add(std::make_shared<NamedVariableList>(
"DisplayNumber", 0));
215 variables.
Add(std::make_shared<NamedVariableList>(
"Width", 1280));
220 variables.
Add(std::make_shared<NamedVariableList>(
"Height", 720));
225 variables.
Add(std::make_shared<NamedVariableList>(
"MaxFPS", 144));
232 std::make_shared<NamedVariableList>(
"AudioDevice",
new StringBlock(
"default")));
bool ShouldAddValueIfNotFoundOrWrongType(const std::string &name)
DLLEXPORT bool Add(std::shared_ptr< NamedVariableList > value)
Adds a value.
DataBlock< std::string > StringBlock
◆ GenerateAppdefine()
DLLEXPORT AppDef * Leviathan::AppDef::GenerateAppdefine |
( |
const std::string & |
engineconfigfile, |
|
|
const std::string & |
gameconfig, |
|
|
const std::string & |
keyconfig, |
|
|
std::function< void(Lock &guard, GameConfiguration *configobj)> |
configchecker, |
|
|
std::function< void(Lock &guard, KeyConfiguration *keysobject)> |
keychecker |
|
) |
| |
|
static |
Definition at line 45 of file AppDefine.cpp.
50 auto tmpptr = std::make_unique<AppDef>(
true);
53 tmpptr->DeleteLog =
true;
57 std::cout <<
"Error: main log hasn't been created before AppDef: GenerateAppdefine" 64 if(!tmpptr->ConfigurationValues->LoadVarsFromFile(engineconfigfile,
Logger::Get())) {
67 tmpptr->FillDefaultEngineConf(*tmpptr->ConfigurationValues);
71 tmpptr->ConfigurationValues->Serialize(), engineconfigfile)) {
74 "AppDef: failed to write default engine config to file: " + engineconfigfile);
78 if(tmpptr->FillDefaultEngineConf(*tmpptr->ConfigurationValues)) {
82 tmpptr->ConfigurationValues->Serialize(), engineconfigfile)) {
84 LOG_ERROR(
"AppDef: failed to write amended engine config to file: " +
93 if(!tmpptr->_GameConfiguration->Init(configchecker)) {
101 if(!tmpptr->_KeyConfiguration->Init(keychecker)) {
106 return tmpptr.release();
Holds key configuration for an application.
static DLLEXPORT Logger * Get()
static DLLEXPORT bool WriteToFile(const std::string &data, const std::string &filename)
◆ GetDefault()
Definition at line 112 of file AppDefine.h.
static AppDef * Defaultconf
◆ GetGameConfiguration()
DLLEXPORT auto* Leviathan::AppDef::GetGameConfiguration |
( |
| ) |
|
|
inline |
Definition at line 102 of file AppDefine.h.
GameConfiguration * _GameConfiguration
◆ GetGameIdentificationData()
DLLEXPORT void Leviathan::AppDef::GetGameIdentificationData |
( |
std::string & |
userreadable, |
|
|
std::string & |
gamename, |
|
|
std::string & |
gameversion |
|
) |
| |
◆ GetKeyConfiguration()
DLLEXPORT auto* Leviathan::AppDef::GetKeyConfiguration |
( |
| ) |
|
|
inline |
Definition at line 107 of file AppDefine.h.
KeyConfiguration * _KeyConfiguration
◆ GetMasterServerInfo()
Definition at line 97 of file AppDefine.h.
MasterServerInformation MasterServerInfo
◆ GetValues()
Definition at line 40 of file AppDefine.cpp.
std::unique_ptr< NamedVars > ConfigurationValues
◆ GetWindowDetails()
Definition at line 93 of file AppDefine.h.
WindowDataDetails WDetails
◆ ReplaceGameAndKeyConfigInMemory()
Creates game and key configurations without file backing that are empty.
Definition at line 109 of file AppDefine.cpp.
120 LOG_ERROR(
"AppDef: failed to init new in-memory game configuration");
128 LOG_ERROR(
"AppDef: failed to init new in-memory key configuration");
KeyConfiguration * _KeyConfiguration
Holds key configuration for an application.
GameConfiguration * _GameConfiguration
DLLEXPORT bool Init(std::function< void(Lock &guard, GameConfiguration *configobj)> sanitycheckcallback)
DLLEXPORT bool Init(std::function< void(Lock &guard, KeyConfiguration *checkfrom)> functocheck)
Loads the defined keys from a file.
◆ SetApplicationIdentification()
DLLEXPORT AppDef & Leviathan::AppDef::SetApplicationIdentification |
( |
const std::string & |
userreadable, |
|
|
const std::string & |
gamename, |
|
|
const std::string & |
gameversion |
|
) |
| |
Definition at line 173 of file AppDefine.cpp.
#define LEVIATHAN_VERSION_ANSIS
std::string LeviathanVersion
std::string UserReadableGame
◆ SetMasterServerParameters()
Definition at line 82 of file AppDefine.h.
MasterServerInformation MasterServerInfo
◆ SetWindowDetails()
Definition at line 75 of file AppDefine.h.
WindowDataDetails WDetails
◆ StoreWindowDetails()
DLLEXPORT void Leviathan::AppDef::StoreWindowDetails |
( |
const std::string & |
title, |
|
|
const bool & |
windowborder, |
|
|
LeviathanApplication * |
appvirtualptr |
|
) |
| |
Definition at line 139 of file AppDefine.cpp.
146 std::string fullscreen;
156 "FullScreen", fullscreen,
"no",
Logger::Get(),
"Create window: ");
157 ObjectFileProcessor::LoadValueFromNamedVars<int>(
160 "DisplayNumber", displayNumber, 0,
Logger::Get(),
"Create window: ");
161 ObjectFileProcessor::LoadValueFromNamedVars<bool>(
166 displayNumber, FSAA, windowborder, icon, appvirtualptr));
169 displayNumber, FSAA, windowborder, appvirtualptr));
std::unique_ptr< NamedVars > ConfigurationValues
static bool LoadValueFromNamedVars(NamedVars *block, const std::string &varname, T &receiver, const T &defaultvalue, LErrorReporter *ReportError=nullptr, const std::string &errorprefix="")
DLLEXPORT AppDef & SetWindowDetails(const WindowDataDetails &det)
static DLLEXPORT Logger * Get()
◆ _GameConfiguration
◆ _KeyConfiguration
◆ _NetworkInterface
◆ ConfigurationValues
std::unique_ptr<NamedVars> Leviathan::AppDef::ConfigurationValues |
|
protected |
◆ Defaultconf
AppDef * Leviathan::AppDef::Defaultconf = nullptr |
|
staticprotected |
◆ DeleteLog
bool Leviathan::AppDef::DeleteLog = false |
|
protected |
Controls whether the destructor deletes Mainlog
- Note
- Used to not delete loggers that weren't created by this instance
Definition at line 169 of file AppDefine.h.
◆ Game
std::string Leviathan::AppDef::Game |
|
protected |
◆ GameVersion
std::string Leviathan::AppDef::GameVersion |
|
protected |
◆ HInstance
int Leviathan::AppDef::HInstance |
|
protected |
◆ LeviathanVersion
std::string Leviathan::AppDef::LeviathanVersion |
|
protected |
◆ Mainlog
Logger* Leviathan::AppDef::Mainlog = nullptr |
|
protected |
◆ MasterServerInfo
◆ UserReadableGame
std::string Leviathan::AppDef::UserReadableGame |
|
protected |
◆ WDetails
The documentation for this class was generated from the following files: