 |
Blamite Game Engine - blam!
00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
7 #include <Strings/components/utils/saferelease/saferelease.h>
13 #define STACKTYPE_GENERIC StackType::Generic
14 #define STACKTYPE_IMGUI StackType::ImGUI
15 #define STACKTYPE_RECT StackType::ST_Rectangle
16 #define STACKTYPE_ROUNDED_RECT StackType::RoundedRect
17 #define STACKTYPE_DWTEXT StackType::DWText
18 #define STACKTYPE_ELLIPSE StackType::ST_Ellipse
19 #define STACKTYPE_LINE StackType::Line
20 #define STACKTYPE_BITMAP StackType::Bitmap
21 #define STACKTYPE_GEOMETRY StackType::Geometry
22 #define STACKTYPE_GLYPHRUN StackType::GlyphRun
23 #define STACKTYPE_FILLEDMESH StackType::FilledMesh
24 #define STACKTYPE_BITMAP_TEXT StackType::BitmapText
25 #define STACKTYPE_FPS_COUNTER StackType::FPSCounter
26 #define STACKTYPE_CONSOLE StackType::Console
27 #define STACKTYPE_STATS StackType::Stats
28 #define STACKTYPE_DEBUG_MENU StackType::DebugMenu
29 #define STACKTYPE_TEXT StackType::Text
33 #define DRAWMODE_FILL StackItemDrawMode::Fill
34 #define DRAWMODE_OUTLINE StackItemDrawMode::Outline
35 #define DRAWMODE_BOTH StackItemDrawMode::Both
37 #define DEFAULT_DRAWMODE DRAWMODE_OUTLINE
49 #define AREA_DEBUG_THICKNESS 2
100 namespace RenderStack
102 class StackObjectBase;
218 unique_id =
"item_" + std::to_string(rand());
252 void SetArea(
float new_area[4]);
262 void SetArea(
float top,
float bottom,
float left,
float right);
269 void SetArea(D2D1_RECT_F new_area);
286 void SetColor(
float r,
float g,
float b);
296 void SetColor(
float r,
float g,
float b,
float a);
336 void SetSize(
float new_width,
float new_height);
686 void SetText(std::string new_text);
693 void SetFont(std::string new_font_name);
751 std::wstring
text = L
"generic text";
788 void ShowImPropertyEditor();
901 DWText* dw_text_shadow = NULL;
905 bool font_exists =
false;
936 void SetFont(std::string new_font_id);
956 std::string
text =
"the quick brown fox jumped over the lazy dog";
StackItemDrawMode draw_mode
The drawing mode of the object.
Definition: render_stack.h:373
D2D1_COLOR_F shadow_color
The color to use for the drop shadow.
Definition: render_stack.h:963
void Draw()
Draws the stack object.
Definition: Text.cpp:163
D2D1_COLOR_F shadow_color
The color to use for the drop shadow.
Definition: render_stack.h:851
Class containing data for a text object using DirectWrite.
Definition: render_stack.h:656
int resource_id
The resource ID of the bitmap.
Definition: render_stack.h:592
bool visible
Whether or not the object is visible.
Definition: render_stack.h:375
BLAM std::vector< StackType > GetStackTypesList()
Retrieves a list of all available stack types.
Definition: render_stack.cpp:191
void SetText(std::string text)
Sets the text to display.
Definition: Text.cpp:39
Line()
Sets the stack type, default starting/ending points, and default zone color.
Definition: render_stack.h:605
@ Both
The item will have both a fill and outline drawn.
Definition: render_stack.h:89
float font_size
The size of the text.
Definition: render_stack.h:753
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:855
float c_scale_factor
Cachced copy of the ui_scale_factor global.
Definition: render_stack.h:889
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: ImGUIObject.cpp:11
void Draw()
Draws the stack object.
Definition: DWText.cpp:12
BLAM std::vector< StackObjectBase * > * GetStack()
Retrieves the render stack contents.
Definition: render_stack.cpp:65
@ ST_Rectangle
Direct2D Rectangle.
Definition: render_stack.h:61
D2D1_RECT_F text_area
The area to use for the text bitmap.
Definition: render_stack.h:859
@ Stats
Stats widget.
Definition: render_stack.h:78
bool show_zone
Whether or not to show the line area.
Definition: render_stack.h:648
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: RoundedRectangle.cpp:33
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:765
float thickness
The current border thickness.
Definition: render_stack.h:511
bool c_show_zone
Cached copy of show_zone
Definition: render_stack.h:884
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:764
DWText()
Sets the stack type and default zone color.
Definition: render_stack.h:662
std::string font_id
The ID of the font.
Definition: render_stack.h:844
D2D1_COLOR_F c_shadow_color
Cached copy of shadow_color
Definition: render_stack.h:883
float c_zone_thickness
Cached copy of zone_thickness
Definition: render_stack.h:886
int bitmap_height
The height of the bitmap.
Definition: render_stack.h:862
std::string GetDrawModeLabel()
Retrieves the current drawing mode of the object.
Definition: StackObjectBase.cpp:130
float c_y
Cached copy of y
Definition: render_stack.h:878
Specialized class for rendering ImGUI using the render stack.
Definition: render_stack.h:388
void SetArea(float new_area[4])
Sets the area of the object.
Definition: StackObjectBase.cpp:6
bool auto_calculate_area
Whether or not to automatically calculate the area for the text.
Definition: render_stack.h:767
ID2D1Bitmap * text_bitmap
The bitmap containing the fully rendered representation of the object.
Definition: render_stack.h:858
void UpdateAllProperties()
Applies any modified parent properties to the appropriate child object.
Definition: Text.cpp:74
#define STACKTYPE_ROUNDED_RECT
Definition: render_stack.h:16
D2D1_POINT_2F start_point
The starting point of the line.
Definition: render_stack.h:643
void SetZOrder(int z)
Sets the Z-Order of the object.
Definition: StackObjectBase.cpp:50
~ImGUIObject()
Empty destructor.
Definition: render_stack.h:402
std::string GetFont()
Retrieves the ID of the active font.
Definition: Text.cpp:151
@ Geometry
Direct2D Geometry (NYI)
Definition: render_stack.h:67
void Draw()
Draws the stack object.
Definition: ellipse.cpp:10
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:756
#define STACKTYPE_DWTEXT
Definition: render_stack.h:17
@ GlyphRun
Direct2D Glyph Run (NYI)
Definition: render_stack.h:68
D2D1_ROUNDED_RECT rounded_rect
The data for the rounded rectangle.
Definition: render_stack.h:513
std::string GetType()
Retrieves the type of item that this stack object is.
Definition: StackObjectBase.cpp:125
@ BitmapText
Bitmap-based text, uses Blamite font system.
Definition: render_stack.h:72
void Draw()
Draws ImGUI to the screen.
Definition: ImGUIObject.cpp:6
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:977
void RefreshTranslation()
Refreshes any translation data and applies them to the child objects.
Definition: Text.cpp:55
@ Console
Console widget.
Definition: render_stack.h:77
@ ST_Ellipse
Direct2D Ellipse.
Definition: render_stack.h:64
StackType type_label
The type of the object.
Definition: render_stack.h:372
~StackObjectBase()
Empty destructor.
Definition: render_stack.h:224
#define STACKTYPE_RECT
Definition: render_stack.h:15
@ Generic
Generic stack type - should probably not be used.
Definition: render_stack.h:57
float zone_thickness
The thickness of the line area border.
Definition: render_stack.h:650
BLAM std::vector< StackItemDrawMode > GetDrawModesList()
Retrieves a list of all available drawing modes.
Definition: render_stack.cpp:216
D2D1_POINT_2F end_point
The ending point of the line.
Definition: render_stack.h:644
int shadow_y
The Y offset of the drop shadow.
Definition: render_stack.h:850
float thickness
The current border thickness.
Definition: render_stack.h:452
std::string c_font
Cached copy of font
Definition: render_stack.h:875
StackObjectBase()
Sets default values and provides a default ID to be used if none is provided.
Definition: render_stack.h:200
void SetFontSize(float new_size)
Sets the size to use for the font.
Definition: DWText.cpp:91
D2D1_COLOR_F c_color
Cached copy of color
Definition: render_stack.h:879
Class containing data for a Rectangle object.
Definition: render_stack.h:418
float thickness
The current border thickness.
Definition: render_stack.h:565
Ellipse()
Sets the stack type, default fill color, ellipse origin point, and ellipse radius.
Definition: render_stack.h:527
std::wstring font_name
The current font name. Defaults to Comic Sans MS. :lmao:
Definition: render_stack.h:752
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:969
bool force_regenerate
If enabled, will force the bitmap to regenerate on the next frame.
Definition: render_stack.h:864
int shadow_x
The X offset of the drop shadow.
Definition: render_stack.h:961
D2D1_ELLIPSE ellipse
The data for the ellipse.
Definition: render_stack.h:567
int z_order
The Z-Order of the object.
Definition: render_stack.h:371
Unfinished class.
Definition: render_stack.h:773
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:856
D2D1_COLOR_F zone_color
The color of the line area border.
Definition: render_stack.h:649
D2D1_COLOR_F c_zone_color
Cached copy of zone_color
Definition: render_stack.h:885
void Draw()
Draws the stack object.
Definition: Rectangle.cpp:10
bool use_background
Whether or not to draw a background behind the text.
Definition: render_stack.h:972
void SetFont(std::string new_font_name)
Sets the font to use for the text.
Definition: DWText.cpp:51
bool c_replace_color_codes
Cached copy of c_replace_color_codes.
Definition: render_stack.h:890
IDWriteFontCollection * font_collection
The thickness of the zone border.
Definition: render_stack.h:761
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Rectangle.cpp:28
std::string text
The text to display.
Definition: render_stack.h:846
@ ImGUI
Specialized stack type to wrap ImGUI.
Definition: render_stack.h:58
D2D1_COLOR_F color
The color of the object.
Definition: render_stack.h:370
int c_bitmap_height
Cached copy of bitmap_height
Definition: render_stack.h:888
Class containing data for a Rounded Rectangle object.
Definition: render_stack.h:463
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:968
void SetText(std::string new_text)
Sets the text to display.
Definition: DWText.cpp:46
float y
The Y coordinate of the object.
Definition: render_stack.h:378
Class containing data for a Bitmap object.
Definition: render_stack.h:573
Text()
Sets the stack type, creates the needed resources, and sets some default colors.
Definition: Text.cpp:12
void SetZoneColor(float new_color[3])
Sets the color to use for the zone edge.
Definition: DWText.cpp:63
@ FilledMesh
Direct2D Filled Mesh (NYI)
Definition: render_stack.h:69
void SetFont(std::string new_font_id)
Sets the font to use for the text.
Definition: Text.cpp:134
Class containing data for an Ellipse object.
Definition: render_stack.h:521
#define BLAM
Definition: render_stack.h:46
~Rectangle()
Empty destructor.
Definition: render_stack.h:440
float c_x
Cached copy of x
Definition: render_stack.h:877
int c_bitmap_width
Cached copy of bitmap_width
Definition: render_stack.h:887
void Draw()
Draws the stack object.
Definition: BitmapText.cpp:13
@ Line
Direct2D Line.
Definition: render_stack.h:65
@ FPSCounter
FPS Counter widget.
Definition: render_stack.h:76
#define DEFAULT_DRAWMODE
Definition: render_stack.h:37
void PokeSize()
Updates the area of the object to account for any width/height changes.
Definition: StackObjectBase.cpp:119
~Bitmap()
Empty destructor.
Definition: render_stack.h:587
virtual void HandleResize()
Called upon window resize events.
Definition: render_stack.h:244
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:872
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Bitmap.cpp:28
#define STACKTYPE_ELLIPSE
Definition: render_stack.h:18
BitmapText()
Sets the stack type, default shadow color, and default zone color.
Definition: render_stack.h:800
~Ellipse()
Empty destructor.
Definition: render_stack.h:548
int bitmap_width
The width of the bitmap.
Definition: render_stack.h:861
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:566
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:757
#define STACKTYPE_LINE
Definition: render_stack.h:19
void SetThickness(float new_thickness)
Sets the thickness of the ellipse's border.
Definition: ellipse.cpp:29
#define STACKTYPE_BITMAP
Definition: render_stack.h:20
bool use_shadow
Whether or not to draw the text with a drop shadow.
Definition: render_stack.h:852
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:755
int shadow_y
The Y offset of the drop shadow.
Definition: render_stack.h:962
void ShowZoneEdge(bool show)
Enables or disables the display of the text area bounds.
Definition: DWText.cpp:56
Structure to contain data for a Font.
Definition: fonts.h:68
std::string unique_id
The unique ID of this object.
Definition: render_stack.h:382
void Draw()
Draws the stack object.
Definition: Bitmap.cpp:13
~Line()
Empty destructor.
Definition: render_stack.h:626
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: DWText.cpp:96
void ValidateSizeAndTranslation()
Validates X/Y coordinates and Width/Height sizes after the area has been modified.
Definition: StackObjectBase.cpp:135
void SetThickness(float new_thickness)
Sets the thickness of the rectangle's border.
Definition: Rectangle.cpp:23
@ RoundedRect
Direct2D Rounded Rectangle.
Definition: render_stack.h:62
void PokeTranslation()
Updates the area of the object to account for any x/y coordinate changes.
Definition: StackObjectBase.cpp:97
void SetTranslation(float new_x, float new_y)
Sets the translation of the object.
Definition: StackObjectBase.cpp:55
#define STACKTYPE_BITMAP_TEXT
Definition: render_stack.h:24
D2D1_RECT_F area
The area of the object.
Definition: render_stack.h:369
bool replace_color_codes
Whether or not to replace any instances of %& with 0xB00B for color codes.
Definition: render_stack.h:868
RoundedRectangle()
Sets the stack type and specified default fill color and radius values.
Definition: render_stack.h:469
bool use_engine_font
Whether to use a font within the engine or a system font.
Definition: render_stack.h:759
BLAM int AddToStack(std::string id, StackObjectBase *object)
Adds an item to the render stack.
Definition: render_stack.cpp:12
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: BitmapText.cpp:120
int c_shadow_x
Cached copy of shadow_x
Definition: render_stack.h:881
float width
The width of the object.
Definition: render_stack.h:379
Namespace for things relating to rendering.
Definition: models.h:150
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:854
void Draw()
Draws the stack object.
Definition: RoundedRectangle.cpp:10
virtual void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: render_stack.h:239
bool currently_locked
While drawing, this is used to prevent deletion.
Definition: render_stack.h:866
ImGUIObject()
Sets the stack type.
Definition: render_stack.h:394
Rectangle()
Sets the stack type and specifies default fill color values.
Definition: render_stack.h:424
@ Outline
The item will be drawn as an outline, with no fill color.
Definition: render_stack.h:88
BLAM std::string GetDrawModeLabel(StackItemDrawMode type)
Retrieves a string representation of the specified drawing mode.
Definition: render_stack.cpp:176
bool auto_calculate_area
Whether or not to automatically calculate the text area.
Definition: render_stack.h:979
void SetZoneThickness(float new_thickness)
Sets the thickness of the zone edge.
Definition: DWText.cpp:86
Class used to wrap around BitmapText and DWText, making the usage of both of them directly unnecessar...
Definition: render_stack.h:896
int shadow_x
The X offset of the drop shadow.
Definition: render_stack.h:849
const char * resource_type
The resource type of the bitmap.
Definition: render_stack.h:593
BLAM void RemoveFromStack(std::string id)
Removes an item from the render stack.
Definition: render_stack.cpp:26
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:512
@ Fill
The item will be drawn as a fill with no outline.
Definition: render_stack.h:87
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:871
bool use_shadow
Whether or not to draw the text with a drop shadow.
Definition: render_stack.h:964
D2D1_COLOR_F bg_color
The color to use for the text background.
Definition: render_stack.h:973
bool c_use_shadow
Cached copy of use_shadow
Definition: render_stack.h:880
std::string c_text
Cached copy of text
Definition: render_stack.h:876
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Text.cpp:188
BLAM std::string GetStackTypeLabel(StackType type)
Retrieves a string representation of the specified stack type.
Definition: render_stack.cpp:133
#define IDB_THEME_DEFAULT_ICON
Definition: resource.h:32
@ Bitmap
Direct2D Bitmap.
Definition: render_stack.h:66
float height
The height of the object.
Definition: render_stack.h:380
#define STACKTYPE_GENERIC
Definition: render_stack.h:13
std::wstring text
The current text to display.
Definition: render_stack.h:751
void PokeEllipseTranslation()
Updates the ellipse origin point based on the x/y coordinates.
Definition: ellipse.cpp:23
Class representing text drawn using a Bitmap-based engine font.
Definition: render_stack.h:794
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Line.cpp:53
Base class for all render stack objects.
Definition: render_stack.h:194
~Text()
Deletes any used resources.
Definition: Text.cpp:32
void PokeRoundedRectArea()
Updates the area of the rounded rectangle after area modification.
Definition: RoundedRectangle.cpp:23
BLAM bool ContainsImGUIObject()
Determines whether or not an ImGUI stack object has been added.
Definition: render_stack.cpp:102
void updateCachedProperties()
Updates the currently cached properties.
Definition: BitmapText.cpp:50
BLAM void Cleanup()
Cleans up any render stack data.
Definition: render_stack.cpp:123
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: ellipse.cpp:34
StackItemDrawMode
Enumerator to specify the stack item draw mode.
Definition: render_stack.h:85
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
void SetSize(float new_width, float new_height)
Sets the size of the object.
Definition: StackObjectBase.cpp:110
@ DebugMenu
Debug menu.
Definition: render_stack.h:79
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:976
void SetThickness(float new_thickness)
Sets the thickness of the line.
Definition: Line.cpp:48
StackType
Enumerator to determine the type of render stack item.
Definition: render_stack.h:54
@ DWText
DirectWrite Text, does not utilize our font system - probably dont use this.
Definition: render_stack.h:63
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:453
~BitmapText()
Releases the rendered bitmap containing the text.
Definition: render_stack.h:821
Bitmap()
Sets the stack type.
Definition: render_stack.h:579
std::string engine_font_id
The ID of the font collection to use.
Definition: render_stack.h:760
#define STACKTYPE_IMGUI
Definition: render_stack.h:14
bool hasAnyPropertyChanged()
Determines if any current properties differ from their cached copies.
Definition: BitmapText.cpp:71
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition: render_stack.cpp:75
void SetThickness(float new_thickness)
Sets the thickness of the rectangle's border.
Definition: RoundedRectangle.cpp:28
int c_shadow_y
Cached copy of shadow_y
Definition: render_stack.h:882
float thickness
The line thickness.
Definition: render_stack.h:646
~RoundedRectangle()
Empty destructor.
Definition: render_stack.h:488
void Draw()
Draws the stack object.
Definition: Line.cpp:14
~DWText()
Empty destructor.
Definition: render_stack.h:677
float x
The X coordinate of the object.
Definition: render_stack.h:377
void PokeLineTranslation()
Pokes the line start/end points to match the coordinates/area.
Definition: Line.cpp:37
float font_size
The size of the font. Only used with TrueType fonts.
Definition: render_stack.h:957
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:967
std::string text
The text to display.
Definition: render_stack.h:956
Class containing data for a Line object.
Definition: render_stack.h:599
virtual void Draw()
Draws the stack object.
Definition: render_stack.h:231
void SetColor(float new_color[3])
Sets the color of the object.
Definition: StackObjectBase.cpp:25