Elaztek Developer Hub
Blamite Game Engine - blam!  00406.12.10.23.1457.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 
23 {
24  top_center,
25  center,
27  top_left,
30  top_right,
33  top_fill,
34  left_fill,
35  right_fill,
37  fill,
38 };
39 
40 
41 #pragma pack(push, 1)
42 struct cui_screen
43 {
45  TAG_BLOCK(basic_components,
46  {
47  bitfield16 flags;
48  int32_t parent_group_index;
49  ascii name;
50  ascii description;
51  TAG_ENUM8(type,
52  {
53  rectangle,
54  text,
55  bitmap,
56  ellipse,
57  });
58 
59  cui_widget_anchor anchor;
60  vector2 position;
61  vector2 size;
62  real rotation;
63  color _color;
64  //MATERIALS
65  /*If you only need to create basic UI elements with standard colors, then you can ignore these fields.
66 
67  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.
68 
69  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.*/
70  tag_reference material_override;
71  TAG_BLOCK(material_exports,
72  {
73  ascii parameter_name;
74  field_reference input_value;
75  });
76  //TEXT
77  /*The fields below are only used by text widgets*/
78  bitfield8 text_flags;
79  color shadow_color;
80  vector2 shadow_offset;
81  int8_t character_height;
82  ascii font_name;
83  ascii text;
84  });
85  TAG_BLOCK(groups,
86  {
87  bitfield16 flags;
88  cui_widget_anchor anchor;
89  ascii name;
90  ascii description;
91  });
92 };
93 #pragma pack(pop)
94 
96 {
97 public:
99  {
100  class_name_long = "cui_screen";
101  class_name_short = "cusc";
102  version = 2;
103 
104  revisions = {
105  {1, "haloman30", "Initial implementation."},
106  {2, "haloman30", "Remove unused 'templates' block, add 'components' and 'groups' blocks"},
107 
108  };
109 
110  tag_size = 96;
111 
112  fields =
113  {
114  new TagReferenceField("string reference", "", { }),
115  new BlockField(622, "basic components", "",
116  {
117  new Bitfield16Field("flags", "",
118  {
119  "hidden",
120  "editor only",
121  "auto update",
122  }),
123  new Int32Field("parent group index", "This index directly matches the index of an entry within the 'groups' block."),
124  new AsciiField("name", ""),
125  new AsciiField("description", ""),
126  new Enum8Field("type", "",
127  {
128  "rectangle",
129  "text",
130  "bitmap",
131  "ellipse",
132  }),
133  new Enum8Field("anchor", "",
134  {
135  "top center",
136  "center",
137  "bottom center",
138  "top left",
139  "center left",
140  "bottom left",
141  "top right",
142  "center right",
143  "bottom right",
144  "top fill",
145  "left fill",
146  "right fill",
147  "bottom fill",
148  "fill",
149  }),
150  new Vector2Field("position", ""),
151  new Vector2Field("size", ""),
152  new RealField("rotation", ""),
153  new ColorField("color", ""),
154  new CommentField("MATERIALS",
155  "If you only need to create basic UI elements with standard colors, then you can ignore these fields.\n"
156  "\n"
157  "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"
158  "\n"
159  "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."),
160  new TagReferenceField("material override", "", { }),
161  new BlockField(148, "material exports", "",
162  {
163  new AsciiField("parameter name", ""),
164  new FieldReferenceField("input value", ""),
165  }),
166  new CommentField("TEXT",
167  "The fields below are only used by text widgets"),
168  new Bitfield8Field("text flags", "",
169  {
170  "auto scale shadow",
171  }),
172  new ColorField("shadow color", ""),
173  new Vector2Field("shadow offset", ""),
174  new Int8Field("character height", ""),
175  new AsciiField("font name", ""),
176  new AsciiField("text", ""),
177  }),
178  new BlockField(259, "groups", "",
179  {
180  new Bitfield16Field("flags", "",
181  {
182  "hidden",
183  "editor only",
184  }),
185  new Enum8Field("anchor", "",
186  {
187  "top center",
188  "center",
189  "bottom center",
190  "top left",
191  "center left",
192  "bottom left",
193  "top right",
194  "center right",
195  "bottom right",
196  "top fill",
197  "left fill",
198  "right fill",
199  "bottom fill",
200  "fill",
201  }),
202  new AsciiField("name", ""),
203  new AsciiField("description", ""),
204  }),
205 
206  };
207  }
208 };
209 
210 namespace Blam::Content::Tags
211 {
212  BLAM cui_screen* GetCuiScreenTag(std::string tag_path);
213 }
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:195
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
cui_screen::TAG_BLOCK
TAG_BLOCK(basic_components, { bitfield16 flags;int32_t parent_group_index;ascii name;ascii 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, { ascii parameter_name;field_reference input_value;});bitfield8 text_flags;color shadow_color;vector2 shadow_offset;int8_t character_height;ascii font_name;ascii text;})
color
BlamColor color
Typedef for a color field, used in tag definitions.
Definition: tags.h:416
AsciiField
Class representing an ascii tag field.
Definition: ascii.h:18
ascii
char ascii[128]
Typedef for an ascii field, used in tag data definitions.
Definition: tags.h:410
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:42
uint8_t
unsigned char uint8_t
Definition: stdint.h:15
cui_widget_anchor::center_right
@ center_right
cui_widget_anchor::center
@ center
Bitfield16Field
Class representing a bitfield16 tag field.
Definition: bitfield.h:44
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:34
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:195
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:332
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:194
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:192
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:193
tag_reference
Structure representing a tag reference.
Definition: tags.h:272
field_reference
Structure representing a field reference.
Definition: tags.h:424
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:191
Blam::Content::Tags::GetCuiScreenTag
BLAM cui_screen * GetCuiScreenTag(std::string tag_path)
Definition: cui_screen.cpp:16
CuiScreenTagClass::CuiScreenTagClass
CuiScreenTagClass()
Definition: cui_screen.h:98
TAG_ENUM8
#define TAG_ENUM8(name,...)
Macro used to aid in the creation of enums within tag structures.
Definition: tags.h:56
cui_widget_anchor::top_right
@ top_right
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:412
Enum8Field
Definition: enum.h:34
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
bitfield16
Typedef for a bitfield16 field, used in tag data definitions.
Definition: tags.h:347
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:196
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:413
bitmap
Definition: bitmap.h:32
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:128
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:22
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:188
name
ARPHIC PUBLIC LICENSE Ltd Yung Chi Taiwan All rights reserved except as specified below Everyone is permitted to copy and distribute verbatim copies of this license but changing it is forbidden Preamble The licenses for most software are designed to take away your freedom to share and change it By the ARPHIC PUBLIC LICENSE specifically permits and encourages you to use this provided that you give the recipients all the rights that we gave you and make sure they can get the modifications of this software Legal Terms Font means the TrueType fonts AR PL Mingti2L AR PL KaitiM AR PL KaitiM and the derivatives of those fonts created through any modification including modifying reordering converting changing font name
Definition: ARPHICPL.TXT:16
Bitfield8Field
Class representing a bitfield8 tag field.
Definition: bitfield.h:33
cui_screen::string_reference
tag_reference string_reference
Definition: cui_screen.h:44
api.h
CuiScreenTagClass
Definition: cui_screen.h:95