 |
Blamite Game Engine - blam!
00263.10.17.20.0001.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
9 #define GVARS_FILE "./globals.xml"
59 return std::string(std::to_string(
r) +
"," + std::to_string(
g) +
"," + std::to_string(
b) +
"," + std::to_string(
a));
80 std::string new_string = format;
87 double r_float = (double)
r / 255.0f;
88 double g_float = (double)
g / 255.0f;
89 double b_float = (double)
b / 255.0f;
90 double a_float = (double)
a / 255.0f;
107 return ToString(
"rgba({r},{g},{b},{a>f})");
123 if (color_values.size() == 3)
125 r = atoi(color_values.at(0).c_str());
126 g = atoi(color_values.at(1).c_str());
127 b = atoi(color_values.at(2).c_str());
132 else if (color_values.size() == 4)
134 r = atoi(color_values.at(0).c_str());
135 g = atoi(color_values.at(1).c_str());
136 b = atoi(color_values.at(2).c_str());
137 a = atoi(color_values.at(3).c_str());
Namespace surrounding all major engine components.
Definition: blam_api.h:17
BLAM std::string Replace(std::string orig, std::string to_replace, std::string replace_with)
Replaces part of a string with another string.
Definition: string.cpp:67
BlamColor()
Definition: globals.h:28
BLAM std::vector< std::string > Split(std::string string, std::string splitter)
Splits a string around any instance of a substring.
Definition: string.cpp:87
BLAM void RegisterGvar(EngineGlobal var)
Registers a new engine global.
Definition: globals.cpp:65
BLAM EngineGlobal * GetGlobal(std::string name)
Retrieves a global with the specified ID.
Definition: globals.cpp:193
BLAM bool GlobalExists(std::string id)
Determines whether or not a global exists.
Definition: globals.cpp:27
float float_value
The float value of the global.
Definition: globals.h:210
std::string info
An optional description of the global.
Definition: globals.h:198
@ Int
Represents an int.
Definition: globals.h:179
BlamColor color_value
The color value of the global.
Definition: globals.h:211
short g
The Green value of the color.
Definition: globals.h:24
@ UnknownGlobal
The specified global does not exist.
Definition: globals.h:161
@ Long
Represents a long.
Definition: globals.h:176
@ GlobalIsProtected
The specified global is protected and cannot be modified during runtime.
Definition: globals.h:165
BLAM bool LoadGlobalsFromFile()
Loads any globals from GVARS_FILE.
Definition: globals.cpp:206
BLAM float * GetGlobalAsFloat(std::string name)
Retrieves a global's value as a float.
Definition: globals.cpp:399
@ InvalidArgs
The provided arguments were invalid.
Definition: globals.h:163
@ Real
Unknown. Referenced within the hs_doc from Halo 2 Sapien.
Definition: globals.h:174
BLAM GvarUpdateResult UpdateGlobalWrap(std::string name, std::string new_value)
Updates a global's raw value.
Definition: globals.cpp:427
bool read_only
Whether or not the global is protected from modification.
Definition: globals.h:200
std::string name
The name of the global.
Definition: globals.h:197
GvarType
Enumerator for the type of global variable.
Definition: globals.h:171
short short_value
The short value of the global.
Definition: globals.h:207
BLAM BlamColor * GetGlobalAsColor(std::string name)
Retrieves a global's value as a BlamColor.
Definition: globals.cpp:411
short a
The Alpha value of the color.
Definition: globals.h:26
@ String
Represents a std::string.
Definition: globals.h:178
short r
The Red value of the color.
Definition: globals.h:23
#define BLAM
Definition: globals.h:12
Structure containing data for a game engine global.
Definition: globals.h:194
@ Float
Represents a float.
Definition: globals.h:180
long long_value
The long value of the global.
Definition: globals.h:208
GvarUpdateResult
Enumerator for the result of a global update attempt.
Definition: globals.h:158
BLAM short * GetGlobalAsShort(std::string name)
Retrieves a global's value as a short.
Definition: globals.cpp:363
BlamColor(short _r, short _g, short _b)
Definition: globals.h:36
@ InvalidType
The provided value was of an invalid type.
Definition: globals.h:160
short b
The Blue value of the color.
Definition: globals.h:25
@ Object
Unknown. Referenced within the hs_doc from Halo 2 Sapien.
Definition: globals.h:177
@ Short
Represents a short.
Definition: globals.h:175
int int_value
The int value of the global.
Definition: globals.h:209
BLAM std::map< std::string, EngineGlobal > * GetGlobalsList()
Retrieves the list of loaded globals.
Definition: globals.cpp:22
@ OutOfBounds
The provided value was too small or too large for the globals' data type.
Definition: globals.h:164
BLAM long * GetGlobalAsLong(std::string name)
Retrieves a global's value as a long.
Definition: globals.cpp:375
@ Color
Represents a BlamColor. See BlamColor for details.
Definition: globals.h:181
@ Boolean
Represents a boolean. Can be true or false.
Definition: globals.h:173
BLAM std::string * GetGlobalAsString(std::string name)
Retrieves a global's value as a string.
Definition: globals.cpp:351
std::string ToString()
Converts the color value to a string.
Definition: globals.h:57
std::string value_raw
The raw value of the global as a string.
Definition: globals.h:199
std::string ToStringForCSS()
Converts the color to a string that can be used with CSS.
Definition: globals.h:105
bool FromString(std::string string)
Attempts to set color information from a string.
Definition: globals.h:119
std::string ToString(std::string format)
Converts the color value to a string in the specified format.
Definition: globals.h:78
BlamColor(short _r, short _g, short _b, short _a)
Definition: globals.h:44
Structure representing a color.
Definition: globals.h:20
GvarType type
The type of the global.
Definition: globals.h:196
@ Ok
The global was updated successfully.
Definition: globals.h:162
BLAM bool * GetGlobalAsBoolean(std::string name)
Retrieves a global's value as a boolean.
Definition: globals.cpp:339
bool boolean_value
The boolean value of the global.
Definition: globals.h:206
BLAM GvarUpdateResult UpdateGlobal(std::string name, std::string new_value)
Updates the value of a String global.
Definition: globals.cpp:570
BLAM std::string GetGvarTypeLabel(GvarType type)
Retrieves a string representation of a global's type, for use in UI.
Definition: globals.cpp:40
BLAM int * GetGlobalAsInteger(std::string name)
Retrieves a global's value as an int.
Definition: globals.cpp:387