Elaztek Developer Hub
Blamite Game Engine - blam!  00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
cui_screen.h
Go to the documentation of this file.
1 // cui_screen [cusc] - Tag Definition //
3 // -------- //
4 // Author: haloman30 //
5 // Revision: 2 //
6 // -------- //
7 // Part of the Blamite Game Engine //
8 // Copyright (c) Elaztek Studios 2013 - 2023 //
10 
11 
12 #pragma once
13 
14 #include <string>
15 #include <blam/api/v1/types/tags.h>
17 
18 #ifndef BLAM
19 #define BLAM
20 #endif
21 
22 #define tag_cusc "cusc"
23 
25 {
26  top_center,
27  center,
29  top_left,
32  top_right,
35  top_fill,
36  left_fill,
37  right_fill,
39  fill,
40 };
41 
42 
43 #pragma pack(push, 1)
44 struct cui_screen
45 {
47  TAG_BLOCK(basic_components,
48  {
49  struct bitfield16_flags
50  {
51  bool hidden : 1;
52  bool editor_only : 1;
53  bool auto_update : 1;
54  bool unused3 : 1;
55  bool unused4 : 1;
56  bool unused5 : 1;
57  bool unused6 : 1;
58  bool unused7 : 1;
59  bool unused8 : 1;
60  bool unused9 : 1;
61  bool unused10 : 1;
62  bool unused11 : 1;
63  bool unused12 : 1;
64  bool unused13 : 1;
65  bool unused14 : 1;
66  bool unused15 : 1;
67  };
68 
69  bitfield16_flags flags;
70  int32_t parent_group_index;
71  data_reference name;
72  data_reference description;
73  TAG_ENUM8(type,
74  {
75  rectangle,
76  text,
77  bitmap,
78  ellipse,
79  });
80 
81  cui_widget_anchor anchor;
82  vector2 position;
83  vector2 size;
84  real rotation;
85  color _color;
86  tag_reference material_override;
87  TAG_BLOCK(material_exports,
88  {
89  data_reference parameter_name;
90  field_reference input_value;
91  });
92  struct bitfield8_text_flags
93  {
94  bool auto_scale_shadow : 1;
95  bool unused1 : 1;
96  bool unused2 : 1;
97  bool unused3 : 1;
98  bool unused4 : 1;
99  bool unused5 : 1;
100  bool unused6 : 1;
101  bool unused7 : 1;
102  };
103 
104  bitfield8_text_flags text_flags;
105  color shadow_color;
106  vector2 shadow_offset;
107  int8_t character_height;
108  data_reference font_name;
109  data_reference text;
110  });
111  TAG_BLOCK(groups,
112  {
113  struct bitfield16_flags
114  {
115  bool hidden : 1;
116  bool editor_only : 1;
117  bool unused2 : 1;
118  bool unused3 : 1;
119  bool unused4 : 1;
120  bool unused5 : 1;
121  bool unused6 : 1;
122  bool unused7 : 1;
123  bool unused8 : 1;
124  bool unused9 : 1;
125  bool unused10 : 1;
126  bool unused11 : 1;
127  bool unused12 : 1;
128  bool unused13 : 1;
129  bool unused14 : 1;
130  bool unused15 : 1;
131  };
132 
133  bitfield16_flags flags;
134  cui_widget_anchor anchor;
135  data_reference name;
136  data_reference description;
137  });
138 };
139 #pragma pack(pop)
140 
142 {
143 public:
145  {
146  class_name_long = "cui_screen";
147  class_name_short = "cusc";
148  version = 2;
149 
150  revisions = {
151  {1, "haloman30", "Initial implementation."},
152  {2, "haloman30", "Remove unused 'templates' block, add 'components' and 'groups' blocks"},
153 
154  };
155 
156  tag_size = 96;
157 
158  fields =
159  {
160  new TagReferenceField("string reference", "", { }),
161  new BlockField(238, "basic components", "",
162  {
163  new Bitfield16Field("flags", "",
164  {
165  "hidden",
166  "editor only",
167  "auto update",
168  }),
169  new Int32Field("parent group index", "This index directly matches the index of an entry within the 'groups' block."),
170  new DataReferenceField("name", ""),
171  new DataReferenceField("description", ""),
172  new Enum8Field("type", "",
173  {
174  "rectangle",
175  "text",
176  "bitmap",
177  "ellipse",
178  }),
179  new Enum8Field("anchor", "",
180  {
181  "top center",
182  "center",
183  "bottom center",
184  "top left",
185  "center left",
186  "bottom left",
187  "top right",
188  "center right",
189  "bottom right",
190  "top fill",
191  "left fill",
192  "right fill",
193  "bottom fill",
194  "fill",
195  }),
196  new Vector2Field("position", ""),
197  new Vector2Field("size", ""),
198  new RealField("rotation", ""),
199  new ColorField("color", ""),
200  new CommentField("MATERIALS",
201  "If you only need to create basic UI elements with standard colors, then you can ignore these fields.\n"
202  "\n"
203  "If you need more direct control over how your UI elements are presented, then you can override the appearance with a custom material tag. You may also pass any data on to a material tag's parameters, if the material supports them.\n"
204  "\n"
205  "Note that if your material tag does not have the appropriate input parameters, or you do not link them correctly using the exports block, then some of the appearance data within this block (such as primary color) may not be used."),
206  new TagReferenceField("material override", "", { }),
207  new BlockField(52, "material exports", "",
208  {
209  new DataReferenceField("parameter name", ""),
210  new FieldReferenceField("input value", ""),
211  }),
212  new CommentField("TEXT",
213  "The fields below are only used by text widgets"),
214  new Bitfield8Field("text flags", "",
215  {
216  "auto scale shadow",
217  }),
218  new ColorField("shadow color", ""),
219  new Vector2Field("shadow offset", ""),
220  new Int8Field("character height", ""),
221  new DataReferenceField("font name", ""),
222  new DataReferenceField("text", ""),
223  }),
224  new BlockField(67, "groups", "",
225  {
226  new Bitfield16Field("flags", "",
227  {
228  "hidden",
229  "editor only",
230  }),
231  new Enum8Field("anchor", "",
232  {
233  "top center",
234  "center",
235  "bottom center",
236  "top left",
237  "center left",
238  "bottom left",
239  "top right",
240  "center right",
241  "bottom right",
242  "top fill",
243  "left fill",
244  "right fill",
245  "bottom fill",
246  "fill",
247  }),
248  new DataReferenceField("name", ""),
249  new DataReferenceField("description", ""),
250  }),
251 
252  };
253  }
254 };
255 
256 namespace Blam::Content::Tags
257 {
258  BLAM cui_screen* GetCuiScreenTag(std::string tag_path);
259 }
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:181
cui_widget_anchor::top_fill
@ top_fill
RealField
Class representing a real tag field.
Definition: real.h:16
cui_widget_anchor::bottom_fill
@ bottom_fill
color
BlamColor color
Typedef for a color field, used in tag definitions.
Definition: tags.h:447
BLAM
#define BLAM
Definition: cui_screen.h:19
Vector2Field
Class representing a vector2 tag field.
Definition: vector.h:34
cui_widget_anchor::right_fill
@ right_fill
cui_widget_anchor::top_center
@ top_center
cui_screen
Definition: cui_screen.h:44
uint8_t
unsigned char uint8_t
Definition: stdint.h:15
DataReferenceField
Class representing a data reference, or dataref for short.
Definition: dataref.h:19
cui_widget_anchor::center_right
@ center_right
cui_widget_anchor::center
@ center
Bitfield16Field
Class representing a bitfield16 tag field.
Definition: bitfield.h:44
tag_cusc
#define tag_cusc
Definition: cui_screen.h:22
TagReferenceField
Class representing a tag reference, or tagref for short.
Definition: tagref.h:20
Blam::API::v1::Tags::GetTagData
BLAM_EXT_API BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: api.cpp:208
int8_t
signed char int8_t
Definition: stdint.h:11
BlamTagClass::fields
std::vector< BlamTagClassField * > fields
A series of tag fields that store the layout of the tag.
Definition: tags.h:209
cui_screen.h
cui_widget_anchor::bottom_center
@ bottom_center
BlamTagClass::revisions
std::vector< BlamTagClassRevision > revisions
List of all tag class revisions. Does not get written to tags, but is included in plugin files.
Definition: tags.h:208
int32_t
int int32_t
Definition: stdint.h:13
plugins.h
cui_widget_anchor::left_fill
@ left_fill
Int8Field
Class representing an int8 tag field.
Definition: int.h:72
BlamTagClass::class_name_short
std::string class_name_short
The short, 4-character name of the tag class.
Definition: tags.h:206
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:207
tag_reference
Structure representing a tag reference.
Definition: tags.h:289
field_reference
Structure representing a field reference.
Definition: tags.h:455
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:205
Blam::Content::Tags::GetCuiScreenTag
BLAM cui_screen * GetCuiScreenTag(std::string tag_path)
Definition: cui_screen.cpp:16
CuiScreenTagClass::CuiScreenTagClass
CuiScreenTagClass()
Definition: cui_screen.h:144
TAG_ENUM8
#define TAG_ENUM8(name,...)
Macro used to aid in the creation of enums within tag structures.
Definition: tags.h:57
cui_widget_anchor::top_right
@ top_right
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:443
cui_screen::TAG_BLOCK
TAG_BLOCK(basic_components, { struct bitfield16_flags { bool hidden :1;bool editor_only :1;bool auto_update :1;bool unused3 :1;bool unused4 :1;bool unused5 :1;bool unused6 :1;bool unused7 :1;bool unused8 :1;bool unused9 :1;bool unused10 :1;bool unused11 :1;bool unused12 :1;bool unused13 :1;bool unused14 :1;bool unused15 :1;};bitfield16_flags flags;int32_t parent_group_index;data_reference name;data_reference description;TAG_ENUM8(type, { rectangle, text, bitmap, ellipse, });cui_widget_anchor anchor;vector2 position;vector2 size;real rotation;color _color;tag_reference material_override;TAG_BLOCK(material_exports, { data_reference parameter_name;field_reference input_value;});struct bitfield8_text_flags { bool auto_scale_shadow :1;bool unused1 :1;bool unused2 :1;bool unused3 :1;bool unused4 :1;bool unused5 :1;bool unused6 :1;bool unused7 :1;};bitfield8_text_flags text_flags;color shadow_color;vector2 shadow_offset;int8_t character_height;data_reference font_name;data_reference text;})
Enum8Field
Definition: enum.h:33
cui_widget_anchor::center_left
@ center_left
cui_widget_anchor::fill
@ fill
Int32Field
Class representing an int32 tag field.
Definition: int.h:46
cui_widget_anchor::bottom_left
@ bottom_left
data_reference
Structure representing a data reference.
Definition: tags.h:342
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:210
ColorField
Class representing a color tag field.
Definition: color.h:19
vector2
BlamVector2 vector2
Typedef for a vector2 field, used in tag definitions.
Definition: tags.h:444
bitmap
Definition: bitmap.h:34
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:132
tags.h
cui_widget_anchor::top_left
@ top_left
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:125
cui_widget_anchor::bottom_right
@ bottom_right
cui_widget_anchor
cui_widget_anchor
Definition: cui_screen.h:24
FieldReferenceField
Class representing a fieldref tag field.
Definition: fieldref.h:17
CommentField
Class representing a comment field.
Definition: comment.h:29
BlockField
Class representing a tag block field, also sometimes referred to as a struct or reflexive in the modd...
Definition: block.h:19
BlamTagClass
Class representing a tag class.
Definition: tags.h:202
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
cui_screen::string_reference
tag_reference string_reference
Definition: cui_screen.h:46
api.h
CuiScreenTagClass
Definition: cui_screen.h:141
BlamTagData::tag_class
std::string tag_class
The tag's short class name.
Definition: tags.h:146