PCG-FPS
v2 m0.22.4
Simple First Person Shooter with Procedurally Generated Level
|
managing and handling of settings for program More...
#include <Settings.h>
Public Types | |
enum | SettingUInt32t { SettingUInt32t::SCR_WIDTH, SettingUInt32t::SCR_HEIGHT, SettingUInt32t::RNG_MODE, SettingUInt32t::RNG_SEED } |
identifiers for settings of type unsigned integer More... | |
enum | SettingFloat { SettingFloat::RND_NEAR, SettingFloat::RND_FAR } |
identifies for settings of type float More... | |
enum | SettingBool { SettingBool::RND_VSYNC, SettingBool::RNG_PRINTSEED, SettingBool::RND_GAMMACORRECTION, SettingBool::RND_COLORCODEDROOMS } |
identifiers for settings of type boolean More... | |
enum | RuntimeBoolSetting { RuntimeBoolSetting::GhostMode, RuntimeBoolSetting::DrawDebugLight, RuntimeBoolSetting::MoveLights, RuntimeBoolSetting::DrawBoundingBox, RuntimeBoolSetting::UseNormalMapping } |
identifiers for settings of type bool only relevant during runtime, they are not written to the settings file More... | |
enum | ShadowType { ShadowType::Off, ShadowType::ShadowMapping, ShadowType::ShadowMappingPCF, ShadowType::ShadowMappingPCFDisk } |
type identifies for shadow mapping types More... | |
Public Member Functions | |
bool | WriteSettingsToFile () |
write settings to path in _settingsFilePath More... | |
bool | WriteSettingsToFile (const std::string path) |
write settings to given path More... | |
bool | ReadSettingsFromFile () |
read settings from path set in _settingsFilePath More... | |
bool | ReadSettingsFromFile (const std::string path) |
read settings from given path More... | |
std::string | PrintSettingsToString () |
write all settings into a single string used to write everything in one big chunk More... | |
Static Public Member Functions | |
static Settings & | GetInstance () |
Get only instance of this class Implements Scott Meyers' singleton pattern. More... | |
Public Attributes | |
std::unordered_map< SettingUInt32t, uint32_t > | _settings_uint32t |
map keeping settings of type unsigned integer and their values More... | |
std::unordered_map< SettingFloat, float > | _settings_float |
map keeping settings of type float and their values More... | |
std::unordered_map< SettingBool, bool > | _settings_bool |
map keeping settings of type boolean and their values More... | |
std::unordered_map< RuntimeBoolSetting, bool > | _runtime_bool |
map keeping settings of type bool only relevant during runtime More... | |
ShadowType | _shadowRenderingMode = ShadowType::ShadowMappingPCF |
type of shadow mapping currently used More... | |
Private Types | |
typedef std::unordered_map< std::string, SettingUInt32t > | StringToSettingIntMap |
typedef to map a string to a setting of type unsigned integer More... | |
typedef std::unordered_map< SettingUInt32t, std::string > | SettingIntToStringMap |
typedef to map settings of type unsigned integer to a string More... | |
typedef std::unordered_map< SettingFloat, std::string > | SettingFloatToStringMap |
typedef to map a setting of type flaot to a string More... | |
typedef std::unordered_map< std::string, SettingFloat > | StringToSettingFloatMap |
typedef to map a string to a setting of type float More... | |
typedef std::unordered_map< SettingBool, std::string > | SettingBoolToStringMap |
typedef mapping a setting of type boolean to a string More... | |
typedef std::unordered_map< std::string, SettingBool > | StringToSettinBoolMap |
typedef mapping a string to a setting of type boolean More... | |
Private Member Functions | |
Settings () | |
default constructor empty as OpenGL-Renderer object is a global object an requiers one at launch, even though it does nothing More... | |
Settings (const Settings &)=delete | |
copy constructor is deleted More... | |
Settings | operator= (const Settings &)=delete |
copy assignment constructor is deleted More... | |
bool | GetSettingsFromFile (const std::string path, std::vector< std::string > &settings) |
read settings from a file into a list of strings More... | |
bool | SetSettingsFromString (std::vector< std::string > settings) |
set settings from a list of strings goes through a list of settings, one per element, and sets values in maps accordingly More... | |
std::string | GetHumanReadableBool (bool v) |
Get boolean value in human readable form: true/false instead of 1/0. More... | |
Private Attributes | |
std::string | _settingsFilePath = "settings.cfg" |
Static Private Attributes | |
static const std::unordered_map< std::string, SettingUInt32t > | MapStringToSettingInt |
mapping table for string to setting of type unsinged integer More... | |
static const std::unordered_map< SettingUInt32t, std::string > | MapSettingIntToString |
mapping table for settings of type unsigned integer to a string More... | |
static const std::unordered_map< SettingFloat, std::string > | MapSettingFloatToString |
mapping table from a setting of type float to a string More... | |
static const std::unordered_map< std::string, SettingFloat > | MapStringToSettingFloat |
mapping table from a string to setting of type float More... | |
static const std::unordered_map< SettingBool, std::string > | MapSettingBoolToString |
mapping table to map a setting of type boolean to a string More... | |
static const std::unordered_map< std::string, SettingBool > | MapStringToSettingBool |
mapping table from a string to a setting of type boolean More... | |
managing and handling of settings for program
Implements Scott Meyers' singleton pattern
|
private |
typedef mapping a setting of type boolean to a string
|
private |
typedef to map a setting of type flaot to a string
|
private |
typedef to map settings of type unsigned integer to a string
|
private |
typedef mapping a string to a setting of type boolean
|
private |
typedef to map a string to a setting of type float
|
private |
typedef to map a string to a setting of type unsigned integer
|
strong |
identifiers for settings of type bool only relevant during runtime, they are not written to the settings file
|
strong |
|
strong |
|
strong |
|
strong |
|
inlineprivate |
default constructor empty as OpenGL-Renderer object is a global object an requiers one at launch, even though it does nothing
|
privatedelete |
copy constructor is deleted
|
private |
Get boolean value in human readable form: true/false instead of 1/0.
v | boolean value return human readable string of boolean value |
|
static |
Get only instance of this class Implements Scott Meyers' singleton pattern.
|
private |
read settings from a file into a list of strings
path | Path settings are read from | |
[out] | settings | reference to list of strings settings will be read to |
copy assignment constructor is deleted
std::string skr::fps2::Settings::PrintSettingsToString | ( | ) |
write all settings into a single string used to write everything in one big chunk
bool skr::fps2::Settings::ReadSettingsFromFile | ( | ) |
read settings from path set in _settingsFilePath
bool skr::fps2::Settings::ReadSettingsFromFile | ( | const std::string | path | ) |
read settings from given path
path | path to file settings are read from |
|
private |
set settings from a list of strings goes through a list of settings, one per element, and sets values in maps accordingly
settings | list of settings |
bool skr::fps2::Settings::WriteSettingsToFile | ( | ) |
write settings to path in _settingsFilePath
bool skr::fps2::Settings::WriteSettingsToFile | ( | const std::string | path | ) |
write settings to given path
path | path settings will be written to |
std::unordered_map<RuntimeBoolSetting, bool> skr::fps2::Settings::_runtime_bool |
map keeping settings of type bool only relevant during runtime
std::unordered_map<SettingBool, bool> skr::fps2::Settings::_settings_bool |
map keeping settings of type boolean and their values
std::unordered_map<SettingFloat, float> skr::fps2::Settings::_settings_float |
map keeping settings of type float and their values
std::unordered_map<SettingUInt32t, uint32_t> skr::fps2::Settings::_settings_uint32t |
map keeping settings of type unsigned integer and their values
|
private |
path to settings file default: settings.cfg in local folder
ShadowType skr::fps2::Settings::_shadowRenderingMode = ShadowType::ShadowMappingPCF |
type of shadow mapping currently used
|
staticprivate |
mapping table to map a setting of type boolean to a string
|
staticprivate |
mapping table from a setting of type float to a string
|
staticprivate |
mapping table for settings of type unsigned integer to a string
|
staticprivate |
mapping table from a string to a setting of type boolean
|
staticprivate |
mapping table from a string to setting of type float
|
staticprivate |
mapping table for string to setting of type unsinged integer