Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
render_stack.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <vector>
4 #include <string>
5 #include <d2d1_1.h>
6 #include <dwrite.h>
7 #include <Strings/components/utils/saferelease/saferelease.h>
8 
9 #include "res/resource.h"
11 
12 //stack type definitions
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
30 
31 
32 //stack object display mode definitions
33 #define DRAWMODE_FILL StackItemDrawMode::Fill
34 #define DRAWMODE_OUTLINE StackItemDrawMode::Outline
35 #define DRAWMODE_BOTH StackItemDrawMode::Both
36 
37 #define DEFAULT_DRAWMODE DRAWMODE_OUTLINE
38 
39 /*
40 Geometry
41 GlyphRun
42 FilledMesh
43 */
44 
45 #ifndef BLAM
46 #define BLAM
47 #endif
48 
49 #define AREA_DEBUG_THICKNESS 2
50 
55 {
56  // Core types
59 
60  // Direct2D Primitives
65  Line,
70 
71  // Custom primitives
73  Text,
74 
75  // Widgets
80 };
81 
86 {
87  Fill,
90 };
91 
92 namespace BlamRendering
93 {
100  namespace RenderStack
101  {
102  class StackObjectBase;
103 
112  BLAM int AddToStack(std::string id, StackObjectBase* object);
113 
119  BLAM void RemoveFromStack(std::string id);
120 
126  BLAM void RemoveFromStack(int index);
127 
135  BLAM StackObjectBase* GetStackItem(std::string id);
136 
143  BLAM bool ContainsImGUIObject();
144 
148  BLAM void Cleanup();
149 
155  BLAM std::vector<StackObjectBase*>* GetStack();
156 
165  BLAM std::string GetStackTypeLabel(StackType type);
166 
175  BLAM std::string GetDrawModeLabel(StackItemDrawMode type);
176 
182  BLAM std::vector<StackType> GetStackTypesList();
183 
189  BLAM std::vector<StackItemDrawMode> GetDrawModesList();
190 
195  {
196  public:
201  {
202  //default area
203  area.top = 0;
204  area.left = 0;
205  area.bottom = 100;
206  area.right = 100;
207 
208  //default color
209  color.r = 1;
210  color.g = 1;
211  color.b = 1;
212  color.a = 1;
213 
214  //default size
215  width = 100;
216  height = 100;
217 
218  unique_id = "item_" + std::to_string(rand());
219  }
220 
225 
231  virtual void Draw() {};
232 
239  virtual void ShowImPropertyEditor() {};
240 
244  virtual void HandleResize() {};
245 
252  void SetArea(float new_area[4]);
253 
262  void SetArea(float top, float bottom, float left, float right);
263 
269  void SetArea(D2D1_RECT_F new_area);
270 
277  void SetColor(float new_color[3]);
278 
286  void SetColor(float r, float g, float b);
287 
296  void SetColor(float r, float g, float b, float a);
297 
303  void SetColor(D2D1::ColorF color);
304 
312  void SetZOrder(int z);
313 
320  void SetTranslation(float new_x, float new_y);
321 
328  void PokeTranslation();
329 
336  void SetSize(float new_width, float new_height);
337 
344  void PokeSize();
345 
353 
359  std::string GetType();
360 
366  std::string GetDrawModeLabel();
367 
368  //data
369  D2D1_RECT_F area;
370  D2D1_COLOR_F color;
371  int z_order = 0;
374 
375  bool visible = true;
376 
377  float x = 0;
378  float y = 0;
379  float width = 100;
380  float height = 100;
381 
382  std::string unique_id = "";
383  };
384 
389  {
390  public:
395  {
397  }
398 
403 
407  void Draw();
408 
409  void ShowImPropertyEditor();
410  };
411 
418  class Rectangle : public StackObjectBase
419  {
420  public:
425  {
427 
428  //default fill color
429  fill_color.r = 1;
430  fill_color.g = 1;
431  fill_color.b = 1;
432  fill_color.a = 1;
433 
434  //unique_id = "item_" + std::to_string(rand());
435  }
436 
441  void Draw();
442  void ShowImPropertyEditor();
443 
449  void SetThickness(float new_thickness);
450 
451  //data
452  float thickness = 1;
453  D2D1_COLOR_F fill_color;
454  };
455 
464  {
465  public:
470  {
472 
473  //default fill color
474  fill_color.r = 1;
475  fill_color.g = 1;
476  fill_color.b = 1;
477  fill_color.a = 1;
478 
479  //default rounded rect radius and area
480  rounded_rect.radiusX = 10;
481  rounded_rect.radiusY = 10;
482  rounded_rect.rect = area;
483  }
484 
489  void Draw();
490  void ShowImPropertyEditor();
491 
497  void SetThickness(float new_thickness);
498 
508  void PokeRoundedRectArea();
509 
510  //data
511  float thickness = 1;
512  D2D1_COLOR_F fill_color;
513  D2D1_ROUNDED_RECT rounded_rect;
514  };
515 
521  class Ellipse : public StackObjectBase
522  {
523  public:
528  {
530 
531  //default fill color
532  fill_color.r = 1;
533  fill_color.g = 1;
534  fill_color.b = 1;
535  fill_color.a = 1;
536 
537  //default ellipse placement and size
538  ellipse.point.x = x;
539  ellipse.point.y = y;
540 
541  ellipse.radiusX = 100;
542  ellipse.radiusY = 100;
543  }
544 
548  ~Ellipse() {}
549  void Draw();
550  void ShowImPropertyEditor();
551 
557  void SetThickness(float new_thickness);
558 
562  void PokeEllipseTranslation();
563 
564  //data
565  float thickness = 1;
566  D2D1_COLOR_F fill_color;
567  D2D1_ELLIPSE ellipse;
568  };
569 
573  class Bitmap : public StackObjectBase
574  {
575  public:
580  {
582  }
583 
587  ~Bitmap() {}
588  void Draw();
589  void ShowImPropertyEditor();
590 
591  //data
593  const char* resource_type = "PNG";
594  };
595 
599  class Line : public StackObjectBase
600  {
601  public:
606  {
608 
609  //default start/end points
610  start_point.x = 50;
611  start_point.y = 50;
612 
613  end_point.x = 250;
614  end_point.y = 250;
615 
616  //default zone color
617  zone_color.r = 1;
618  zone_color.g = 0;
619  zone_color.b = 0;
620  zone_color.a = 1;
621  }
622 
626  ~Line() {}
627  void Draw();
628  void ShowImPropertyEditor();
629 
633  void PokeLineTranslation();
634 
640  void SetThickness(float new_thickness);
641 
642  //data
643  D2D1_POINT_2F start_point;
644  D2D1_POINT_2F end_point;
645 
646  float thickness = 1;
647 
648  bool show_zone = false;
649  D2D1_COLOR_F zone_color;
650  float zone_thickness = 1;
651  };
652 
656  class DWText : public StackObjectBase
657  {
658  public:
663  {
664  //set type so we can fetch it elsewhere
666 
667  //default zone color
668  zone_color.r = 1;
669  zone_color.g = 0;
670  zone_color.b = 0;
671  zone_color.a = 1;
672  }
673 
677  ~DWText() {};
678  void Draw();
679  void ShowImPropertyEditor();
680 
686  void SetText(std::string new_text);
687 
693  void SetFont(std::string new_font_name);
694 
700  void ShowZoneEdge(bool show);
701 
708  void SetZoneColor(float new_color[3]);
709 
717  void SetZoneColor(float r, float g, float b);
718 
727  void SetZoneColor(float r, float g, float b, float a);
728 
734  void SetZoneColor(D2D1::ColorF color);
735 
741  void SetFontSize(float new_size);
742 
748  void SetZoneThickness(float new_thickness);
749 
750  //data
751  std::wstring text = L"generic text";
752  std::wstring font_name = L"Comic Sans MS";
753  float font_size = 12;
754 
755  bool show_zone = false;
756  D2D1_COLOR_F zone_color;
757  float zone_thickness = 1;
758 
759  bool use_engine_font = false;
760  std::string engine_font_id = "";
761  IDWriteFontCollection* font_collection;
762 
763  // Text buffers for ImGUI property view
764  char text_buffer[1024] = "";
765  char font_buffer[256] = "";
766 
767  bool auto_calculate_area = false;
768  };
769 
774  {
778  StackGroup()
779  {
780 
781  }
782 
786  ~StackGroup() {};
787  void Draw();
788  void ShowImPropertyEditor();
789  };
790 
795  {
796  public:
801  {
803 
804  //default shadow color
805  shadow_color.r = 0;
806  shadow_color.g = 0;
807  shadow_color.b = 0;
808  shadow_color.a = 1;
809 
810  zone_color.r = 1;
811  zone_color.g = 0;
812  zone_color.b = 0;
813  zone_color.a = 1;
814 
815  text_bitmap = NULL;
816  }
817 
822  {
823  SafeRelease(&text_bitmap);
824  }
825 
826  void Draw();
827  void ShowImPropertyEditor();
828 
835  void updateCachedProperties();
836 
842  bool hasAnyPropertyChanged();
843 
844  std::string font_id = "undefined";
845 
846  std::string text = "abba";
847 
848  //drop shadow
849  int shadow_x = 1;
850  int shadow_y = 1;
851  D2D1_COLOR_F shadow_color;
852  bool use_shadow = false;
853 
854  bool show_zone = false;
855  D2D1_COLOR_F zone_color;
856  float zone_thickness = 1;
857 
858  ID2D1Bitmap* text_bitmap;
859  D2D1_RECT_F text_area;
860 
861  int bitmap_width = 0;
862  int bitmap_height = 0;
863 
864  bool force_regenerate = false;
865 
866  bool currently_locked = false;
867 
868  bool replace_color_codes = false;
869 
870  // Text buffers for ImGUI property view
871  char text_buffer[1024] = "";
872  char font_buffer[256] = "";
873 
874  // Cached properties
875  std::string c_font;
876  std::string c_text;
877  float c_x;
878  float c_y;
879  D2D1_COLOR_F c_color;
883  D2D1_COLOR_F c_shadow_color;
884  bool c_show_zone;
885  D2D1_COLOR_F c_zone_color;
891  };
892 
896  class Text : public StackObjectBase
897  {
898  private:
899  BitmapText* bitmap_text = NULL;
900  DWText* dw_text = NULL;
901  DWText* dw_text_shadow = NULL;
902 
903  // Font data
904  Blam::Content::Fonts::Font* font = NULL;
905  bool font_exists = false;
906  public:
910  Text();
911 
915  ~Text();
916 
922  void SetText(std::string text);
923 
929  void UpdateAllProperties();
930 
936  void SetFont(std::string new_font_id);
937 
943  std::string GetFont();
944 
950  void RefreshTranslation();
951 
952  void Draw();
953  void ShowImPropertyEditor();
954 
955  // Font properties
956  std::string text = "the quick brown fox jumped over the lazy dog";
957  float font_size = 12.0f;
958 
959  // Text shadow properties
960 
961  int shadow_x = 1;
962  int shadow_y = 1;
963  D2D1_COLOR_F shadow_color;
964  bool use_shadow = false;
965 
966  // Zone properties
967  bool show_zone = false;
968  D2D1_COLOR_F zone_color;
969  float zone_thickness = 1;
970 
971  // Background
972  bool use_background = false;
973  D2D1_COLOR_F bg_color;
974 
975  // Text buffers for ImGUI property view
976  char text_buffer[1024] = "";
977  char font_buffer[256] = "";
978 
979  bool auto_calculate_area = false;
980  };
981  }
982 }
BlamRendering::RenderStack::StackObjectBase::draw_mode
StackItemDrawMode draw_mode
The drawing mode of the object.
Definition: render_stack.h:373
BlamRendering::RenderStack::Text::shadow_color
D2D1_COLOR_F shadow_color
The color to use for the drop shadow.
Definition: render_stack.h:963
BlamRendering::RenderStack::Text::Draw
void Draw()
Draws the stack object.
Definition: Text.cpp:163
BlamRendering::RenderStack::BitmapText::shadow_color
D2D1_COLOR_F shadow_color
The color to use for the drop shadow.
Definition: render_stack.h:851
BlamRendering::RenderStack::DWText
Class containing data for a text object using DirectWrite.
Definition: render_stack.h:656
BlamRendering::RenderStack::Bitmap::resource_id
int resource_id
The resource ID of the bitmap.
Definition: render_stack.h:592
BlamRendering::RenderStack::StackObjectBase::visible
bool visible
Whether or not the object is visible.
Definition: render_stack.h:375
BlamRendering::RenderStack::GetStackTypesList
BLAM std::vector< StackType > GetStackTypesList()
Retrieves a list of all available stack types.
Definition: render_stack.cpp:191
BlamRendering::RenderStack::Text::SetText
void SetText(std::string text)
Sets the text to display.
Definition: Text.cpp:39
BlamRendering::RenderStack::Line::Line
Line()
Sets the stack type, default starting/ending points, and default zone color.
Definition: render_stack.h:605
Both
@ Both
The item will have both a fill and outline drawn.
Definition: render_stack.h:89
BlamRendering::RenderStack::DWText::font_size
float font_size
The size of the text.
Definition: render_stack.h:753
BlamRendering::RenderStack::BitmapText::zone_color
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:855
BlamRendering::RenderStack::BitmapText::c_scale_factor
float c_scale_factor
Cachced copy of the ui_scale_factor global.
Definition: render_stack.h:889
BlamRendering::RenderStack::ImGUIObject::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: ImGUIObject.cpp:11
BlamRendering::RenderStack::DWText::Draw
void Draw()
Draws the stack object.
Definition: DWText.cpp:12
BlamRendering::RenderStack::GetStack
BLAM std::vector< StackObjectBase * > * GetStack()
Retrieves the render stack contents.
Definition: render_stack.cpp:65
ST_Rectangle
@ ST_Rectangle
Direct2D Rectangle.
Definition: render_stack.h:61
BlamRendering::RenderStack::BitmapText::text_area
D2D1_RECT_F text_area
The area to use for the text bitmap.
Definition: render_stack.h:859
Stats
@ Stats
Stats widget.
Definition: render_stack.h:78
BlamRendering::RenderStack::Line::show_zone
bool show_zone
Whether or not to show the line area.
Definition: render_stack.h:648
BlamRendering::RenderStack::RoundedRectangle::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: RoundedRectangle.cpp:33
BlamRendering::RenderStack::DWText::font_buffer
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:765
BlamRendering::RenderStack::RoundedRectangle::thickness
float thickness
The current border thickness.
Definition: render_stack.h:511
BlamRendering::RenderStack::BitmapText::c_show_zone
bool c_show_zone
Cached copy of show_zone
Definition: render_stack.h:884
BlamRendering::RenderStack::DWText::text_buffer
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:764
BlamRendering::RenderStack::DWText::DWText
DWText()
Sets the stack type and default zone color.
Definition: render_stack.h:662
BlamRendering::RenderStack::BitmapText::font_id
std::string font_id
The ID of the font.
Definition: render_stack.h:844
BlamRendering::RenderStack::BitmapText::c_shadow_color
D2D1_COLOR_F c_shadow_color
Cached copy of shadow_color
Definition: render_stack.h:883
BlamRendering::RenderStack::BitmapText::c_zone_thickness
float c_zone_thickness
Cached copy of zone_thickness
Definition: render_stack.h:886
BlamRendering::RenderStack::BitmapText::bitmap_height
int bitmap_height
The height of the bitmap.
Definition: render_stack.h:862
BlamRendering::RenderStack::StackObjectBase::GetDrawModeLabel
std::string GetDrawModeLabel()
Retrieves the current drawing mode of the object.
Definition: StackObjectBase.cpp:130
BlamRendering::RenderStack::BitmapText::c_y
float c_y
Cached copy of y
Definition: render_stack.h:878
BlamRendering::RenderStack::ImGUIObject
Specialized class for rendering ImGUI using the render stack.
Definition: render_stack.h:388
BlamRendering::RenderStack::StackObjectBase::SetArea
void SetArea(float new_area[4])
Sets the area of the object.
Definition: StackObjectBase.cpp:6
BlamRendering::RenderStack::DWText::auto_calculate_area
bool auto_calculate_area
Whether or not to automatically calculate the area for the text.
Definition: render_stack.h:767
BlamRendering::RenderStack::BitmapText::text_bitmap
ID2D1Bitmap * text_bitmap
The bitmap containing the fully rendered representation of the object.
Definition: render_stack.h:858
BlamRendering::RenderStack::Text::UpdateAllProperties
void UpdateAllProperties()
Applies any modified parent properties to the appropriate child object.
Definition: Text.cpp:74
STACKTYPE_ROUNDED_RECT
#define STACKTYPE_ROUNDED_RECT
Definition: render_stack.h:16
BlamRendering::RenderStack::Line::start_point
D2D1_POINT_2F start_point
The starting point of the line.
Definition: render_stack.h:643
BlamRendering::RenderStack::StackObjectBase::SetZOrder
void SetZOrder(int z)
Sets the Z-Order of the object.
Definition: StackObjectBase.cpp:50
BlamRendering::RenderStack::ImGUIObject::~ImGUIObject
~ImGUIObject()
Empty destructor.
Definition: render_stack.h:402
BlamRendering::RenderStack::Text::GetFont
std::string GetFont()
Retrieves the ID of the active font.
Definition: Text.cpp:151
Geometry
@ Geometry
Direct2D Geometry (NYI)
Definition: render_stack.h:67
BlamRendering::RenderStack::Ellipse::Draw
void Draw()
Draws the stack object.
Definition: ellipse.cpp:10
BlamRendering::RenderStack::DWText::zone_color
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:756
STACKTYPE_DWTEXT
#define STACKTYPE_DWTEXT
Definition: render_stack.h:17
GlyphRun
@ GlyphRun
Direct2D Glyph Run (NYI)
Definition: render_stack.h:68
BlamRendering::RenderStack::RoundedRectangle::rounded_rect
D2D1_ROUNDED_RECT rounded_rect
The data for the rounded rectangle.
Definition: render_stack.h:513
BlamRendering::RenderStack::StackObjectBase::GetType
std::string GetType()
Retrieves the type of item that this stack object is.
Definition: StackObjectBase.cpp:125
BitmapText
@ BitmapText
Bitmap-based text, uses Blamite font system.
Definition: render_stack.h:72
BlamRendering::RenderStack::ImGUIObject::Draw
void Draw()
Draws ImGUI to the screen.
Definition: ImGUIObject.cpp:6
BlamRendering::RenderStack::Text::font_buffer
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:977
BlamRendering::RenderStack::Text::RefreshTranslation
void RefreshTranslation()
Refreshes any translation data and applies them to the child objects.
Definition: Text.cpp:55
Console
@ Console
Console widget.
Definition: render_stack.h:77
ST_Ellipse
@ ST_Ellipse
Direct2D Ellipse.
Definition: render_stack.h:64
BlamRendering::RenderStack::StackObjectBase::type_label
StackType type_label
The type of the object.
Definition: render_stack.h:372
BlamRendering::RenderStack::StackObjectBase::~StackObjectBase
~StackObjectBase()
Empty destructor.
Definition: render_stack.h:224
STACKTYPE_RECT
#define STACKTYPE_RECT
Definition: render_stack.h:15
Generic
@ Generic
Generic stack type - should probably not be used.
Definition: render_stack.h:57
BlamRendering::RenderStack::Line::zone_thickness
float zone_thickness
The thickness of the line area border.
Definition: render_stack.h:650
BlamRendering::RenderStack::GetDrawModesList
BLAM std::vector< StackItemDrawMode > GetDrawModesList()
Retrieves a list of all available drawing modes.
Definition: render_stack.cpp:216
BlamRendering::RenderStack::Line::end_point
D2D1_POINT_2F end_point
The ending point of the line.
Definition: render_stack.h:644
BlamRendering::RenderStack::BitmapText::shadow_y
int shadow_y
The Y offset of the drop shadow.
Definition: render_stack.h:850
BlamRendering::RenderStack::Rectangle::thickness
float thickness
The current border thickness.
Definition: render_stack.h:452
BlamRendering::RenderStack::BitmapText::c_font
std::string c_font
Cached copy of font
Definition: render_stack.h:875
BlamRendering::RenderStack::StackObjectBase::StackObjectBase
StackObjectBase()
Sets default values and provides a default ID to be used if none is provided.
Definition: render_stack.h:200
BlamRendering::RenderStack::DWText::SetFontSize
void SetFontSize(float new_size)
Sets the size to use for the font.
Definition: DWText.cpp:91
BlamRendering::RenderStack::BitmapText::c_color
D2D1_COLOR_F c_color
Cached copy of color
Definition: render_stack.h:879
BlamRendering::RenderStack::Rectangle
Class containing data for a Rectangle object.
Definition: render_stack.h:418
BlamRendering::RenderStack::Ellipse::thickness
float thickness
The current border thickness.
Definition: render_stack.h:565
BlamRendering::RenderStack::Ellipse::Ellipse
Ellipse()
Sets the stack type, default fill color, ellipse origin point, and ellipse radius.
Definition: render_stack.h:527
BlamRendering::RenderStack::DWText::font_name
std::wstring font_name
The current font name. Defaults to Comic Sans MS. :lmao:
Definition: render_stack.h:752
BlamRendering::RenderStack::Text::zone_thickness
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:969
BlamRendering::RenderStack::BitmapText::force_regenerate
bool force_regenerate
If enabled, will force the bitmap to regenerate on the next frame.
Definition: render_stack.h:864
BlamRendering::RenderStack::Text::shadow_x
int shadow_x
The X offset of the drop shadow.
Definition: render_stack.h:961
BlamRendering::RenderStack::Ellipse::ellipse
D2D1_ELLIPSE ellipse
The data for the ellipse.
Definition: render_stack.h:567
BlamRendering::RenderStack::StackObjectBase::z_order
int z_order
The Z-Order of the object.
Definition: render_stack.h:371
BlamRendering::RenderStack::StackGroup
Unfinished class.
Definition: render_stack.h:773
BlamRendering::RenderStack::BitmapText::zone_thickness
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:856
BlamRendering::RenderStack::Line::zone_color
D2D1_COLOR_F zone_color
The color of the line area border.
Definition: render_stack.h:649
BlamRendering::RenderStack::BitmapText::c_zone_color
D2D1_COLOR_F c_zone_color
Cached copy of zone_color
Definition: render_stack.h:885
BlamRendering::RenderStack::Rectangle::Draw
void Draw()
Draws the stack object.
Definition: Rectangle.cpp:10
BlamRendering::RenderStack::Text::use_background
bool use_background
Whether or not to draw a background behind the text.
Definition: render_stack.h:972
BlamRendering::RenderStack::DWText::SetFont
void SetFont(std::string new_font_name)
Sets the font to use for the text.
Definition: DWText.cpp:51
BlamRendering::RenderStack::BitmapText::c_replace_color_codes
bool c_replace_color_codes
Cached copy of c_replace_color_codes.
Definition: render_stack.h:890
BlamRendering::RenderStack::DWText::font_collection
IDWriteFontCollection * font_collection
The thickness of the zone border.
Definition: render_stack.h:761
BlamRendering::RenderStack::Rectangle::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Rectangle.cpp:28
BlamRendering::RenderStack::BitmapText::text
std::string text
The text to display.
Definition: render_stack.h:846
ImGUI
@ ImGUI
Specialized stack type to wrap ImGUI.
Definition: render_stack.h:58
BlamRendering::RenderStack::StackObjectBase::color
D2D1_COLOR_F color
The color of the object.
Definition: render_stack.h:370
BlamRendering::RenderStack::BitmapText::c_bitmap_height
int c_bitmap_height
Cached copy of bitmap_height
Definition: render_stack.h:888
BlamRendering::RenderStack::RoundedRectangle
Class containing data for a Rounded Rectangle object.
Definition: render_stack.h:463
BlamRendering::RenderStack::Text::zone_color
D2D1_COLOR_F zone_color
The color to use for the zone border.
Definition: render_stack.h:968
BlamRendering::RenderStack::DWText::SetText
void SetText(std::string new_text)
Sets the text to display.
Definition: DWText.cpp:46
BlamRendering::RenderStack::StackObjectBase::y
float y
The Y coordinate of the object.
Definition: render_stack.h:378
BlamRendering::RenderStack::Bitmap
Class containing data for a Bitmap object.
Definition: render_stack.h:573
BlamRendering::RenderStack::Text::Text
Text()
Sets the stack type, creates the needed resources, and sets some default colors.
Definition: Text.cpp:12
BlamRendering::RenderStack::DWText::SetZoneColor
void SetZoneColor(float new_color[3])
Sets the color to use for the zone edge.
Definition: DWText.cpp:63
FilledMesh
@ FilledMesh
Direct2D Filled Mesh (NYI)
Definition: render_stack.h:69
BlamRendering::RenderStack::Text::SetFont
void SetFont(std::string new_font_id)
Sets the font to use for the text.
Definition: Text.cpp:134
BlamRendering::RenderStack::Ellipse
Class containing data for an Ellipse object.
Definition: render_stack.h:521
BLAM
#define BLAM
Definition: render_stack.h:46
BlamRendering::RenderStack::Rectangle::~Rectangle
~Rectangle()
Empty destructor.
Definition: render_stack.h:440
BlamRendering::RenderStack::BitmapText::c_x
float c_x
Cached copy of x
Definition: render_stack.h:877
BlamRendering::RenderStack::BitmapText::c_bitmap_width
int c_bitmap_width
Cached copy of bitmap_width
Definition: render_stack.h:887
BlamRendering::RenderStack::BitmapText::Draw
void Draw()
Draws the stack object.
Definition: BitmapText.cpp:13
Line
@ Line
Direct2D Line.
Definition: render_stack.h:65
FPSCounter
@ FPSCounter
FPS Counter widget.
Definition: render_stack.h:76
DEFAULT_DRAWMODE
#define DEFAULT_DRAWMODE
Definition: render_stack.h:37
resource.h
BlamRendering::RenderStack::StackObjectBase::PokeSize
void PokeSize()
Updates the area of the object to account for any width/height changes.
Definition: StackObjectBase.cpp:119
BlamRendering::RenderStack::Bitmap::~Bitmap
~Bitmap()
Empty destructor.
Definition: render_stack.h:587
BlamRendering::RenderStack::StackObjectBase::HandleResize
virtual void HandleResize()
Called upon window resize events.
Definition: render_stack.h:244
BlamRendering::RenderStack::BitmapText::font_buffer
char font_buffer[256]
Font name buffer for ImGUI editor.
Definition: render_stack.h:872
BlamRendering::RenderStack::Bitmap::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Bitmap.cpp:28
STACKTYPE_ELLIPSE
#define STACKTYPE_ELLIPSE
Definition: render_stack.h:18
BlamRendering::RenderStack::BitmapText::BitmapText
BitmapText()
Sets the stack type, default shadow color, and default zone color.
Definition: render_stack.h:800
BlamRendering::RenderStack::Ellipse::~Ellipse
~Ellipse()
Empty destructor.
Definition: render_stack.h:548
BlamRendering::RenderStack::BitmapText::bitmap_width
int bitmap_width
The width of the bitmap.
Definition: render_stack.h:861
BlamRendering::RenderStack::Ellipse::fill_color
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:566
BlamRendering::RenderStack::DWText::zone_thickness
float zone_thickness
The thickness of the zone border.
Definition: render_stack.h:757
STACKTYPE_LINE
#define STACKTYPE_LINE
Definition: render_stack.h:19
BlamRendering::RenderStack::Ellipse::SetThickness
void SetThickness(float new_thickness)
Sets the thickness of the ellipse's border.
Definition: ellipse.cpp:29
STACKTYPE_BITMAP
#define STACKTYPE_BITMAP
Definition: render_stack.h:20
BlamRendering::RenderStack::BitmapText::use_shadow
bool use_shadow
Whether or not to draw the text with a drop shadow.
Definition: render_stack.h:852
BlamRendering::RenderStack::DWText::show_zone
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:755
BlamRendering::RenderStack::Text::shadow_y
int shadow_y
The Y offset of the drop shadow.
Definition: render_stack.h:962
BlamRendering::RenderStack::DWText::ShowZoneEdge
void ShowZoneEdge(bool show)
Enables or disables the display of the text area bounds.
Definition: DWText.cpp:56
Blam::Content::Fonts::Font
Structure to contain data for a Font.
Definition: fonts.h:68
BlamRendering::RenderStack::StackObjectBase::unique_id
std::string unique_id
The unique ID of this object.
Definition: render_stack.h:382
BlamRendering::RenderStack::Bitmap::Draw
void Draw()
Draws the stack object.
Definition: Bitmap.cpp:13
BlamRendering::RenderStack::Line::~Line
~Line()
Empty destructor.
Definition: render_stack.h:626
BlamRendering::RenderStack::DWText::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: DWText.cpp:96
BlamRendering::RenderStack::StackObjectBase::ValidateSizeAndTranslation
void ValidateSizeAndTranslation()
Validates X/Y coordinates and Width/Height sizes after the area has been modified.
Definition: StackObjectBase.cpp:135
BlamRendering::RenderStack::Rectangle::SetThickness
void SetThickness(float new_thickness)
Sets the thickness of the rectangle's border.
Definition: Rectangle.cpp:23
RoundedRect
@ RoundedRect
Direct2D Rounded Rectangle.
Definition: render_stack.h:62
BlamRendering::RenderStack::StackObjectBase::PokeTranslation
void PokeTranslation()
Updates the area of the object to account for any x/y coordinate changes.
Definition: StackObjectBase.cpp:97
BlamRendering::RenderStack::StackObjectBase::SetTranslation
void SetTranslation(float new_x, float new_y)
Sets the translation of the object.
Definition: StackObjectBase.cpp:55
STACKTYPE_BITMAP_TEXT
#define STACKTYPE_BITMAP_TEXT
Definition: render_stack.h:24
BlamRendering::RenderStack::StackObjectBase::area
D2D1_RECT_F area
The area of the object.
Definition: render_stack.h:369
BlamRendering::RenderStack::BitmapText::replace_color_codes
bool replace_color_codes
Whether or not to replace any instances of %& with 0xB00B for color codes.
Definition: render_stack.h:868
BlamRendering::RenderStack::RoundedRectangle::RoundedRectangle
RoundedRectangle()
Sets the stack type and specified default fill color and radius values.
Definition: render_stack.h:469
BlamRendering::RenderStack::DWText::use_engine_font
bool use_engine_font
Whether to use a font within the engine or a system font.
Definition: render_stack.h:759
BlamRendering::RenderStack::AddToStack
BLAM int AddToStack(std::string id, StackObjectBase *object)
Adds an item to the render stack.
Definition: render_stack.cpp:12
BlamRendering::RenderStack::BitmapText::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: BitmapText.cpp:120
BlamRendering::RenderStack::BitmapText::c_shadow_x
int c_shadow_x
Cached copy of shadow_x
Definition: render_stack.h:881
BlamRendering::RenderStack::StackObjectBase::width
float width
The width of the object.
Definition: render_stack.h:379
BlamRendering
Namespace for things relating to rendering.
Definition: models.h:150
BlamRendering::RenderStack::BitmapText::show_zone
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:854
BlamRendering::RenderStack::RoundedRectangle::Draw
void Draw()
Draws the stack object.
Definition: RoundedRectangle.cpp:10
BlamRendering::RenderStack::StackObjectBase::ShowImPropertyEditor
virtual void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: render_stack.h:239
BlamRendering::RenderStack::BitmapText::currently_locked
bool currently_locked
While drawing, this is used to prevent deletion.
Definition: render_stack.h:866
BlamRendering::RenderStack::ImGUIObject::ImGUIObject
ImGUIObject()
Sets the stack type.
Definition: render_stack.h:394
BlamRendering::RenderStack::Rectangle::Rectangle
Rectangle()
Sets the stack type and specifies default fill color values.
Definition: render_stack.h:424
Outline
@ Outline
The item will be drawn as an outline, with no fill color.
Definition: render_stack.h:88
BlamRendering::RenderStack::GetDrawModeLabel
BLAM std::string GetDrawModeLabel(StackItemDrawMode type)
Retrieves a string representation of the specified drawing mode.
Definition: render_stack.cpp:176
BlamRendering::RenderStack::Text::auto_calculate_area
bool auto_calculate_area
Whether or not to automatically calculate the text area.
Definition: render_stack.h:979
BlamRendering::RenderStack::DWText::SetZoneThickness
void SetZoneThickness(float new_thickness)
Sets the thickness of the zone edge.
Definition: DWText.cpp:86
BlamRendering::RenderStack::Text
Class used to wrap around BitmapText and DWText, making the usage of both of them directly unnecessar...
Definition: render_stack.h:896
BlamRendering::RenderStack::BitmapText::shadow_x
int shadow_x
The X offset of the drop shadow.
Definition: render_stack.h:849
BlamRendering::RenderStack::Bitmap::resource_type
const char * resource_type
The resource type of the bitmap.
Definition: render_stack.h:593
BlamRendering::RenderStack::RemoveFromStack
BLAM void RemoveFromStack(std::string id)
Removes an item from the render stack.
Definition: render_stack.cpp:26
BlamRendering::RenderStack::RoundedRectangle::fill_color
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:512
Fill
@ Fill
The item will be drawn as a fill with no outline.
Definition: render_stack.h:87
BlamRendering::RenderStack::BitmapText::text_buffer
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:871
BlamRendering::RenderStack::Text::use_shadow
bool use_shadow
Whether or not to draw the text with a drop shadow.
Definition: render_stack.h:964
BlamRendering::RenderStack::Text::bg_color
D2D1_COLOR_F bg_color
The color to use for the text background.
Definition: render_stack.h:973
BlamRendering::RenderStack::BitmapText::c_use_shadow
bool c_use_shadow
Cached copy of use_shadow
Definition: render_stack.h:880
BlamRendering::RenderStack::BitmapText::c_text
std::string c_text
Cached copy of text
Definition: render_stack.h:876
BlamRendering::RenderStack::Text::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Text.cpp:188
BlamRendering::RenderStack::GetStackTypeLabel
BLAM std::string GetStackTypeLabel(StackType type)
Retrieves a string representation of the specified stack type.
Definition: render_stack.cpp:133
IDB_THEME_DEFAULT_ICON
#define IDB_THEME_DEFAULT_ICON
Definition: resource.h:32
Bitmap
@ Bitmap
Direct2D Bitmap.
Definition: render_stack.h:66
BlamRendering::RenderStack::StackObjectBase::height
float height
The height of the object.
Definition: render_stack.h:380
STACKTYPE_GENERIC
#define STACKTYPE_GENERIC
Definition: render_stack.h:13
BlamRendering::RenderStack::DWText::text
std::wstring text
The current text to display.
Definition: render_stack.h:751
BlamRendering::RenderStack::Ellipse::PokeEllipseTranslation
void PokeEllipseTranslation()
Updates the ellipse origin point based on the x/y coordinates.
Definition: ellipse.cpp:23
BlamRendering::RenderStack::BitmapText
Class representing text drawn using a Bitmap-based engine font.
Definition: render_stack.h:794
BlamRendering::RenderStack::Line::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: Line.cpp:53
BlamRendering::RenderStack::StackObjectBase
Base class for all render stack objects.
Definition: render_stack.h:194
BlamRendering::RenderStack::Text::~Text
~Text()
Deletes any used resources.
Definition: Text.cpp:32
BlamRendering::RenderStack::RoundedRectangle::PokeRoundedRectArea
void PokeRoundedRectArea()
Updates the area of the rounded rectangle after area modification.
Definition: RoundedRectangle.cpp:23
BlamRendering::RenderStack::ContainsImGUIObject
BLAM bool ContainsImGUIObject()
Determines whether or not an ImGUI stack object has been added.
Definition: render_stack.cpp:102
fonts.h
BlamRendering::RenderStack::BitmapText::updateCachedProperties
void updateCachedProperties()
Updates the currently cached properties.
Definition: BitmapText.cpp:50
BlamRendering::RenderStack::Cleanup
BLAM void Cleanup()
Cleans up any render stack data.
Definition: render_stack.cpp:123
BlamRendering::RenderStack::Ellipse::ShowImPropertyEditor
void ShowImPropertyEditor()
Shows a set of ImGUI properties associated with the object.
Definition: ellipse.cpp:34
StackItemDrawMode
StackItemDrawMode
Enumerator to specify the stack item draw mode.
Definition: render_stack.h:85
Text
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
BlamRendering::RenderStack::StackObjectBase::SetSize
void SetSize(float new_width, float new_height)
Sets the size of the object.
Definition: StackObjectBase.cpp:110
DebugMenu
@ DebugMenu
Debug menu.
Definition: render_stack.h:79
BlamRendering::RenderStack::Text::text_buffer
char text_buffer[1024]
Text buffer for ImGUI editor.
Definition: render_stack.h:976
BlamRendering::RenderStack::Line::SetThickness
void SetThickness(float new_thickness)
Sets the thickness of the line.
Definition: Line.cpp:48
StackType
StackType
Enumerator to determine the type of render stack item.
Definition: render_stack.h:54
DWText
@ DWText
DirectWrite Text, does not utilize our font system - probably dont use this.
Definition: render_stack.h:63
BlamRendering::RenderStack::Rectangle::fill_color
D2D1_COLOR_F fill_color
The current fill color.
Definition: render_stack.h:453
BlamRendering::RenderStack::BitmapText::~BitmapText
~BitmapText()
Releases the rendered bitmap containing the text.
Definition: render_stack.h:821
BlamRendering::RenderStack::Bitmap::Bitmap
Bitmap()
Sets the stack type.
Definition: render_stack.h:579
BlamRendering::RenderStack::DWText::engine_font_id
std::string engine_font_id
The ID of the font collection to use.
Definition: render_stack.h:760
STACKTYPE_IMGUI
#define STACKTYPE_IMGUI
Definition: render_stack.h:14
BlamRendering::RenderStack::BitmapText::hasAnyPropertyChanged
bool hasAnyPropertyChanged()
Determines if any current properties differ from their cached copies.
Definition: BitmapText.cpp:71
BlamRendering::RenderStack::GetStackItem
BLAM StackObjectBase * GetStackItem(std::string id)
Retrieves an item from the render stack.
Definition: render_stack.cpp:75
BlamRendering::RenderStack::RoundedRectangle::SetThickness
void SetThickness(float new_thickness)
Sets the thickness of the rectangle's border.
Definition: RoundedRectangle.cpp:28
BlamRendering::RenderStack::BitmapText::c_shadow_y
int c_shadow_y
Cached copy of shadow_y
Definition: render_stack.h:882
BlamRendering::RenderStack::Line::thickness
float thickness
The line thickness.
Definition: render_stack.h:646
BlamRendering::RenderStack::RoundedRectangle::~RoundedRectangle
~RoundedRectangle()
Empty destructor.
Definition: render_stack.h:488
BlamRendering::RenderStack::Line::Draw
void Draw()
Draws the stack object.
Definition: Line.cpp:14
BlamRendering::RenderStack::DWText::~DWText
~DWText()
Empty destructor.
Definition: render_stack.h:677
BlamRendering::RenderStack::StackObjectBase::x
float x
The X coordinate of the object.
Definition: render_stack.h:377
BlamRendering::RenderStack::Line::PokeLineTranslation
void PokeLineTranslation()
Pokes the line start/end points to match the coordinates/area.
Definition: Line.cpp:37
BlamRendering::RenderStack::Text::font_size
float font_size
The size of the font. Only used with TrueType fonts.
Definition: render_stack.h:957
BlamRendering::RenderStack::Text::show_zone
bool show_zone
Whether or not to show the text zone.
Definition: render_stack.h:967
BlamRendering::RenderStack::Text::text
std::string text
The text to display.
Definition: render_stack.h:956
BlamRendering::RenderStack::Line
Class containing data for a Line object.
Definition: render_stack.h:599
BlamRendering::RenderStack::StackObjectBase::Draw
virtual void Draw()
Draws the stack object.
Definition: render_stack.h:231
BlamRendering::RenderStack::StackObjectBase::SetColor
void SetColor(float new_color[3])
Sets the color of the object.
Definition: StackObjectBase.cpp:25