52 static std::string
getCfgStr(
const std::string& section,
const std::string& key);
61 static size_t getCfgSizeT(
const std::string& section,
const std::string& key);
70 static float getCfgFloat(
const std::string& section,
const std::string& key);
80 static bool getCfgBool(
const std::string& section,
const std::string& key);
94 static inline float clampLH(
float& value,
const float lowLimit,
const float highLimit) {
95 float original = value;
96 value = std::max(lowLimit, std::min(value, highLimit));
97 return original - value;
106 static inline float clampL(
float& value,
const float lowLimit) {
107 float original = value;
108 value = std::max(value, lowLimit);
109 return original - value;
118 static inline float clampH(
float& value,
const float highLimit) {
119 float original = value;
120 value = std::min(value, highLimit);
121 return original - value;
134 return static_cast<float>(GetRandomValue(0, RAND_MAX)) /
static_cast<float>(RAND_MAX);
143 inline static int randi(
const int low,
const int high) {
144 return GetRandomValue(low, high);
Provides utility functions for the game.
Definition: util.hpp:26
static float clampH(float &value, const float highLimit)
Clamp a float value to a maximum and return the excess.
Definition: util.hpp:118
static size_t getCfgSizeT(const std::string §ion, const std::string &key)
Get a size_t from the configuration file.
Definition: util.cpp:29
static std::string getCfgStr(const std::string §ion, const std::string &key)
Get a string from the configuration file.
Definition: util.cpp:15
static std::string getAbsDir()
Get the absolute path to the game's directory.
Definition: util.cpp:3
static float getCfgFloat(const std::string §ion, const std::string &key)
Get a float from the configuration file.
Definition: util.cpp:44
static float clampLH(float &value, const float lowLimit, const float highLimit)
Clamp a float value between two limits and return the excess.
Definition: util.hpp:94
static bool getCfgBool(const std::string §ion, const std::string &key)
Get a bool from the configuration file.
Definition: util.cpp:54
static float clampL(float &value, const float lowLimit)
Clamp a float value to a minimum and return the excess.
Definition: util.hpp:106
static float randf()
Get a random float value between 0.0f and 1.0f.
Definition: util.hpp:133
static int randi(const int low, const int high)
Get a random integer value between two limits.
Definition: util.hpp:143