 |
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.
7 #include "components/3rdparty/imgui/imgui.h"
9 #include "components/3rdparty/imgui/extensions/imgui_extensions.h"
49 ImGui::TextColored(ImVec4(1.0, 0.0, 0.0, 1.0), std::string(
"<field '" +
display_name +
"' has no imgui control available>").c_str());
75 std::string field_string =
"<unknown id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"false\" />";
90 AsciiField(std::string _display_name, std::string _extra_info)
114 std::string field_string =
"<ascii id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" length=\"" + std::to_string(
read_length) +
"\" visible=\"true\" />";
128 Int32Field(std::string _display_name, std::string _extra_info)
152 std::string field_string =
"<int32 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\" />";
166 Int16Field(std::string _display_name, std::string _extra_info)
178 ImGui::DragInt(
display_name.c_str(), &value_expand, 1.0f, -32768, 32767);
194 std::string field_string =
"<int16 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\" />";
208 Int8Field(std::string _display_name, std::string _extra_info)
220 ImGui::DragInt(
display_name.c_str(), &value_expand, 1.0f, 0, 255);
236 std::string field_string =
"<int8 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\" />";
275 std::string field_string =
"<boolean id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\" />";
314 std::string field_string =
"<colorf id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\" format=\"rgba\" />";
329 std::vector<std::string> options;
330 int* active_item = 0;
333 EnumField(std::string _display_name, std::string _extra_info, std::vector<std::string> _options)
346 if (ImGui::BeginCombo(
display_name.c_str(), options.at(*active_item).c_str()))
348 for (
int i = 0; i < options.size(); i++)
350 if (ImGui::Selectable(options.at(i).c_str()))
371 std::string field_string =
"<enum id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\">";
373 for (
int i = 0; i < options.size(); i++)
375 field_string +=
"<option id=\"" + field_id +
"\" name=\"" +
display_name +
"\" value=\"" + std::to_string(i) +
"\" visible=\"true\"/>";
378 field_string +=
"</enum>";
395 Bitfield8Field(std::string _display_name, std::string _extra_info, std::vector<std::string> _options)
408 int region_width = ImGui::CalcItemWidth();
411 ImGui::BeginChild(
display_name.c_str(), ImVec2(region_width, region_height),
true, ImGuiWindowFlags_HorizontalScrollbar);
413 int max_bits_available = 0;
421 max_bits_available =
options.size();
424 for (
int i = 0; i <
options.size(); i++)
428 ImGui::Checkbox(
options.at(i).c_str(), (
bool*)prop_address);
435 for (
int i = 0; i < unused_options; i++)
437 bool helper_value =
false;
439 ImGui::Checkbox(
"", &helper_value);
441 ImGui::TextDisabled(
"unused bit");
462 std::string field_string =
"<bitfield8 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\">";
464 for (
int i = 0; i <
options.size(); i++)
466 field_string +=
"<bit id=\"" + field_id +
"\" name=\"" +
display_name +
"\" index=\"" + std::to_string(i) +
"\" visible=\"true\"/>";
469 field_string +=
"</bitfield8>";
486 Bitfield16Field(std::string _display_name, std::string _extra_info, std::vector<std::string> _options)
499 int region_width = ImGui::CalcItemWidth();
502 ImGui::BeginChild(
display_name.c_str(), ImVec2(region_width, region_height),
true, ImGuiWindowFlags_HorizontalScrollbar);
504 int max_bits_available = 0;
512 max_bits_available =
options.size();
515 for (
int i = 0; i <
options.size(); i++)
519 ImGui::Checkbox(
options.at(i).c_str(), (
bool*)prop_address);
526 for (
int i = 0; i < unused_options; i++)
528 bool helper_value =
false;
530 ImGui::Checkbox(
"", &helper_value);
532 ImGui::TextDisabled(
"unused bit");
553 std::string field_string =
"<bitfield16 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\">";
555 for (
int i = 0; i <
options.size(); i++)
557 field_string +=
"<bit id=\"" + field_id +
"\" name=\"" +
display_name +
"\" index=\"" + std::to_string(i) +
"\" visible=\"true\"/>";
560 field_string +=
"</bitfield16>";
577 Bitfield32Field(std::string _display_name, std::string _extra_info, std::vector<std::string> _options)
590 int region_width = ImGui::CalcItemWidth();
593 ImGui::BeginChild(
display_name.c_str(), ImVec2(region_width, region_height),
true, ImGuiWindowFlags_HorizontalScrollbar);
595 int max_bits_available = 0;
603 max_bits_available =
options.size();
606 for (
int i = 0; i <
options.size(); i++)
610 ImGui::Checkbox(
options.at(i).c_str(), (
bool*)prop_address);
617 for (
int i = 0; i < unused_options; i++)
619 bool helper_value =
false;
621 ImGui::Checkbox(
"", &helper_value);
623 ImGui::TextDisabled(
"unused bit");
644 std::string field_string =
"<bitfield32 id=\"" + field_id +
"\" name=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" visible=\"true\">";
646 for (
int i = 0; i <
options.size(); i++)
648 field_string +=
"<bit id=\"" + field_id +
"\" name=\"" +
display_name +
"\" index=\"" + std::to_string(i) +
"\" visible=\"true\"/>";
651 field_string +=
"</bitfield32>";
699 std::string field_string =
"<comment title=\"" +
display_name +
"\" visible=\"true\">";
703 field_string +=
"</comment>";
718 std::vector<std::string> valid_classes;
719 int active_class_index = 0;
720 std::string active_tag_class_label;
722 std::vector<tag_memory_data> filtered_tag_list;
723 int active_tag_index = 0;
725 TagReference(std::string _display_name, std::string _extra_info, std::vector<std::string> _valid_classes)
729 valid_classes = _valid_classes;
746 float indent = 22.0f;
755 Block(
int _entry_size, std::string _display_name, std::string _extra_info, std::vector<TagField*> _block_template)
775 std::string field_string =
"<reflexive id=\"" + field_id +
"\" title=\"" +
display_name +
"\" offset=\"" + std::to_string(offset) +
"\" entrySize=\"" + std::to_string(
entry_size) +
"\" visible=\"true\">";
777 int field_offset = 0;
781 field_string +=
block_template.at(i)->GetFieldXMLString(field_offset);
785 field_string +=
"</reflexive>";
812 ImGui::Indent(indent);
816 ImGui::PushID(block_id.c_str());
817 if (ImGui::Button(
"Add"))
851 if (ImGui::Button(
"Insert"))
858 if (ImGui::Button(
"Duplicate"))
865 if (ImGui::Button(
"Delete"))
872 if (ImGui::Button(
"Delete All"))
879 ImGui::PushItemWidth(70.0f);
880 if (ImGui::BeginCombo(
"entry", std::to_string(
active_entry).c_str()))
884 std::string label =
"entry " + std::to_string(i);
886 if (ImGui::Selectable(label.c_str()))
894 ImGui::PopItemWidth();
900 void* next_field_address = entry_start_address;
916 ImGui::Unindent(indent);
Class representing a tag reference, or tagref for short.
Definition: fields.h:715
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
Namespace containing things related to tag data.
Definition: bitmap.h:9
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:33
TagReference(std::string _display_name, std::string _extra_info, std::vector< std::string > _valid_classes)
Definition: fields.h:725
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:366
BLAM std::string ToLower(std::string string)
Transforms a string to all-lowercase.
Definition: string.cpp:49
int active_entry
The index of the active entry.
Definition: fields.h:750
Int8Field(std::string _display_name, std::string _extra_info)
Definition: fields.h:208
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:405
char ascii[32]
Typedef for an ascii field, used in tag data definitions.
Definition: fields.h:20
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:216
void * entry_data_address
The address of the blocks' entry data.
Definition: tags.h:82
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:587
virtual std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:70
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:457
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:98
char block_identifier[6]
Special variable that is used for saving tag data to a file from within the engine....
Definition: tags.h:80
Bitfield16Field(std::string _display_name, std::string _extra_info, std::vector< std::string > _options)
Definition: fields.h:486
AsciiField(std::string _display_name, std::string _extra_info)
Definition: fields.h:90
Class representing a bitfield8 tag field.
Definition: fields.h:389
Class representing a tag block, also referred to as a struct or reflexive in the modding community.
Definition: fields.h:743
int max_items_to_show
Maximum number of bitfield options to show.
Definition: fields.h:484
Bitfield8Field(std::string _display_name, std::string _extra_info, std::vector< std::string > _options)
Definition: fields.h:395
std::vector< std::string > options
List of options available in the bitfield.
Definition: fields.h:392
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:770
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:548
EnumField(std::string _display_name, std::string _extra_info, std::vector< std::string > _options)
Definition: fields.h:333
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:790
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:231
int entry_size
The size of each block entry.
Definition: tags.h:81
bool bitfield8[8]
Typedef for a bitfield8 field, used in tag data definitions.
Definition: fields.h:17
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:136
Class representing an enum tag field.
Definition: fields.h:326
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:109
Int32Field(std::string _display_name, std::string _extra_info)
Definition: fields.h:128
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:189
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:309
Class representing a color tag field.
Definition: fields.h:287
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.cpp:45
ColorFloatField(std::string _display_name, std::string _extra_info)
Definition: fields.h:290
BooleanField(std::string _display_name, std::string _extra_info)
Definition: fields.h:251
std::vector< std::string > options
List of options available in the bitfield.
Definition: fields.h:483
void * read_address
The address of the data the field is currently representing.
Definition: fields.h:39
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:639
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:298
Structure representing a tag reference.
Definition: tags.h:89
std::vector< TagField * > block_template
The list of block entries in this block.
Definition: fields.h:749
Class representing an int8 tag field.
Definition: fields.h:205
int entry_size
The size of each block entry.
Definition: fields.h:753
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:174
Base class representing a tag field.
Definition: fields.h:33
int read_length
How many bytes to read from the start of the address.
Definition: fields.h:40
std::string extra_info
Additional information to show alongside the field.
Definition: fields.h:37
Class representing a bitfield32 tag field.
Definition: fields.h:571
Class representing an int32 tag field.
Definition: fields.h:125
bool bitfield16[16]
Typedef for a bitfield16 field, used in tag data definitions.
Definition: fields.h:18
void SetMemoryLocation(void *new_address)
Sets the read location of the tag field.
Definition: fields.h:765
int max_items_to_show
Maximum number of bitfield options to show.
Definition: fields.h:575
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:270
Int16Field(std::string _display_name, std::string _extra_info)
Definition: fields.h:166
bool bitfield32[32]
Typedef for a bitfield32 field, used in tag data definitions.
Definition: fields.h:19
std::vector< std::string > options
List of options available in the bitfield.
Definition: fields.h:574
Class representing an ascii tag field.
Definition: fields.h:87
int max_items_to_show
Maximum number of bitfield options to show.
Definition: fields.h:393
virtual void SetMemoryLocation(void *new_address)
Sets the read location of the tag field.
Definition: fields.h:55
std::string display_name
The display name of the tag field.
Definition: fields.h:36
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:496
Block(int _entry_size, std::string _display_name, std::string _extra_info, std::vector< TagField * > _block_template)
Definition: fields.h:755
tag_block * block_info
Pointer to the current block info being represented.
Definition: fields.h:751
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:342
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.cpp:5
Class representing a boolean tag field.
Definition: fields.h:248
Class representing an int16 tag field.
Definition: fields.h:163
std::string GetFieldXMLString(int offset)
Generates a string representing an XML node associated with this tag field, used for generating plugi...
Definition: fields.h:147
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
virtual void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:47
Bitfield32Field(std::string _display_name, std::string _extra_info, std::vector< std::string > _options)
Definition: fields.h:577
Class representing a bitfield16 tag field.
Definition: fields.h:480
void ShowImPropertyControl()
Shows a set of ImGUI controls representing the tag field.
Definition: fields.h:259
int entry_count
The number of entries within the tag block.
Definition: tags.h:83