Elaztek Developer Hub
Blamite Game Engine - blam!  00398.09.22.23.2015.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>
18 
19 #ifndef BLAM
20 #define BLAM
21 #endif
22 
24 {
25  top_center,
26  center,
28  top_left,
31  top_right,
34  top_fill,
35  left_fill,
36  right_fill,
38  fill,
39 };
40 
41 
42 #pragma pack(push, 1)
43 struct cui_screen
44 {
46  TAG_BLOCK(basic_components,
47  {
48  bitfield16 flags;
49  int32_t parent_group_index;
50  ascii name;
51  ascii description;
52  TAG_ENUM8(type,
53  {
54  rectangle,
55  text,
56  bitmap,
57  ellipse,
58  });
59 
60  cui_widget_anchor anchor;
61  vector2 position;
62  vector2 size;
63  real rotation;
64  color _color;
65  //MATERIALS
66  /*If you only need to create basic UI elements with standard colors, then you can ignore these fields.
67 
68  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.
69 
70  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.*/
71  tag_reference material_override;
72  TAG_BLOCK(material_exports,
73  {
74  ascii parameter_name;
75  field_reference input_value;
76  });
77  //TEXT
78  /*The fields below are only used by text widgets*/
79  bitfield8 text_flags;
80  color shadow_color;
81  vector2 shadow_offset;
82  int8_t character_height;
83  ascii font_name;
84  ascii text;
85  });
86  TAG_BLOCK(groups,
87  {
88  bitfield16 flags;
89  cui_widget_anchor anchor;
90  ascii name;
91  ascii description;
92  });
93 };
94 #pragma pack(pop)
95 
97 {
98 public:
100  {
101  class_name_long = "cui_screen";
102  class_name_short = "cusc";
103  version = 2;
104 
105  revisions = {
106  {1, "haloman30", "Initial implementation."},
107  {2, "haloman30", "Remove unused 'templates' block, add 'components' and 'groups' blocks"},
108 
109  };
110 
111  tag_size = 96;
112 
113  fields =
114  {
115  new TagReferenceField("string reference", "", { }),
116  new BlockField(622, "basic components", "",
117  {
118  new Bitfield16Field("flags", "",
119  {
120  "hidden",
121  "editor only",
122  "auto update",
123  }),
124  new Int32Field("parent group index", "This index directly matches the index of an entry within the 'groups' block."),
125  new AsciiField("name", ""),
126  new AsciiField("description", ""),
127  new Enum8Field("type", "",
128  {
129  "rectangle",
130  "text",
131  "bitmap",
132  "ellipse",
133  }),
134  new Enum8Field("anchor", "",
135  {
136  "top center",
137  "center",
138  "bottom center",
139  "top left",
140  "center left",
141  "bottom left",
142  "top right",
143  "center right",
144  "bottom right",
145  "top fill",
146  "left fill",
147  "right fill",
148  "bottom fill",
149  "fill",
150  }),
151  new Vector2Field("position", ""),
152  new Vector2Field("size", ""),
153  new RealField("rotation", ""),
154  new ColorField("color", ""),
155  new CommentField("MATERIALS",
156  "If you only need to create basic UI elements with standard colors, then you can ignore these fields.\n"
157  "\n"
158  "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"
159  "\n"
160  "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."),
161  new TagReferenceField("material override", "", { }),
162  new BlockField(148, "material exports", "",
163  {
164  new AsciiField("parameter name", ""),
165  new FieldReferenceField("input value", ""),
166  }),
167  new CommentField("TEXT",
168  "The fields below are only used by text widgets"),
169  new Bitfield8Field("text flags", "",
170  {
171  "auto scale shadow",
172  }),
173  new ColorField("shadow color", ""),
174  new Vector2Field("shadow offset", ""),
175  new Int8Field("character height", ""),
176  new AsciiField("font name", ""),
177  new AsciiField("text", ""),
178  }),
179  new BlockField(259, "groups", "",
180  {
181  new Bitfield16Field("flags", "",
182  {
183  "hidden",
184  "editor only",
185  }),
186  new Enum8Field("anchor", "",
187  {
188  "top center",
189  "center",
190  "bottom center",
191  "top left",
192  "center left",
193  "bottom left",
194  "top right",
195  "center right",
196  "bottom right",
197  "top fill",
198  "left fill",
199  "right fill",
200  "bottom fill",
201  "fill",
202  }),
203  new AsciiField("name", ""),
204  new AsciiField("description", ""),
205  }),
206 
207  };
208  }
209 };
210 
211 namespace Blam::Content::Tags
212 {
213  BLAM cui_screen* GetCuiScreenTag(std::string tag_path);
214 }
Blam::Content::Tags
Namespace containing functions related to tag data.
Definition: bitmap.h:196
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:359
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:353
BLAM
#define BLAM
Definition: cui_screen.h:20
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:43
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
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:138
bitfield8
Typedef for a bitfield8 field, used in tag data definitions.
Definition: tags.h:275
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:137
int32_t
int int32_t
Definition: stdint.h:13
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:135
BlamTagClass::version
int version
The tag class version. Should be incremented any time a tag class is modified whatsoever.
Definition: tags.h:136
tag_reference
Structure representing a tag reference.
Definition: tags.h:215
field_reference
Structure representing a field reference.
Definition: tags.h:367
BlamTagClass::class_name_long
std::string class_name_long
The longer class name. Typically shown alongside short name for user-friendliness.
Definition: tags.h:134
TAG_ENUM8
#define TAG_ENUM8(name,...)
Definition: tags.h:32
Blam::Content::Tags::GetCuiScreenTag
BLAM cui_screen * GetCuiScreenTag(std::string tag_path)
Definition: cui_screen.cpp:16
CuiScreenTagClass::CuiScreenTagClass
CuiScreenTagClass()
Definition: cui_screen.h:99
cui_widget_anchor::top_right
@ top_right
real
float real
Typedef for a 'real', aka a float.
Definition: tags.h:355
Blam::Content::Tags::GetTagData
BLAM BlamTagData * GetTagData(std::string tag_path)
Retrieves information for a given tag.
Definition: tags.cpp:80
Enum8Field
Definition: enum.h:34
cui_widget_anchor::center_left
@ center_left
cui_widget_anchor::fill
@ fill
fields.h
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:290
BlamTagClass::tag_size
int tag_size
The size of the tag's data. Used on loading/writing tag files.
Definition: tags.h:139
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:356
bitmap
Definition: bitmap.h:33
BlamTagData::address
void * address
The address pointing to the start of the tag's data.
Definition: tags.h:71
tagclass.h
tags.h
tags.h
cui_widget_anchor::top_left
@ top_left
BlamTagData
Class used to contain and access tag data.
Definition: tags.h:68
cui_widget_anchor::bottom_right
@ bottom_right
cui_widget_anchor
cui_widget_anchor
Definition: cui_screen.h:23
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:21
BlamTagClass
Class representing a tag class.
Definition: tags.h:131
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:45
CuiScreenTagClass
Definition: cui_screen.h:96