mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-07 08:15:59 -10:00
pareshi for HDR colors
This commit is contained in:
1 parent
e03bb48bb3
commit
6c473e7c09
2 files changed
+27
No files matched your search
@@ -1,5 +1,7 @@
|
||||
#include "parsehi.h"
|
||||
#include "globalincs/vmallocator.h"
|
||||
#include "parselo.h"
|
||||
#include "graphics/color.h"
|
||||
|
||||
/**
|
||||
* @brief Parses an optional table value into a field if the name is found
|
||||
@@ -34,3 +36,25 @@ bool parse_optional_bool_into(const SCP_string& field_name, bool* value_target)
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Parses an optional table color into an object if the color is found
|
||||
*
|
||||
* @param field_name The name of the table field
|
||||
* @param value_target Pointer to the variable to assign any parsed value to
|
||||
*
|
||||
* @return True if a value was parsed, false if not
|
||||
*/
|
||||
bool parse_optional_color3i_into(const SCP_string& field_name, hdr_color* out_color)
|
||||
{
|
||||
if (optional_string(field_name.c_str())) {
|
||||
int components[3] = {255, 255, 255};
|
||||
stuff_int_list(components, 3, RAW_INTEGER_TYPE);
|
||||
if (out_color == nullptr) {
|
||||
out_color = new hdr_color();
|
||||
}
|
||||
out_color->set_rgb(components);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "parse/parselo.h"
|
||||
#include "graphics/color.h"
|
||||
|
||||
//parsehi is intended for higher level, frequently used combinations of parselo functions
|
||||
//and also for collection of standardized parsing of complex types where appropriate
|
||||
@@ -7,3 +8,5 @@
|
||||
extern bool parse_optional_float_into(const SCP_string& field_name, float* value_target);
|
||||
|
||||
extern bool parse_optional_bool_into(const SCP_string& field_name, bool* value_target);
|
||||
|
||||
extern bool parse_optional_color3i_into(const SCP_string &field_name, hdr_color *out_color);
|
||||
Reference in new issue
Block a user