 |
Blamite Game Engine - blam!
00453.06.08.26.0624.blamite
The core library for the Blamite Game Engine.
|
Go to the documentation of this file.
3 #include <Strings/components/resources/color/BlamColor.h>
4 #include <OGRE/Overlay/OgreTextAreaOverlayElement.h>
5 #include <OGRE/Overlay/OgreOverlayContainer.h>
6 #include <OGRE/Overlay/OgrePanelOverlayElement.h>
7 #include <OGRE/Overlay/OgreOverlay.h>
8 #include <OGRE/OgreManualObject2.h>
9 #include <OGRE/OgreSceneManager.h>
10 #include <bgfx/bgfx.h>
88 std::string custom_type_name =
"UNSPECIFIED";
98 void ShowAnchorChangeButton(
BlamWidgetAnchor new_anchor,
int height_mul,
int width_mul,
bool text_multiline);
117 BlamVector2
size = { 100, 100 };
211 void SetSize(BlamVector2 new_size);
218 virtual void SetPosition(BlamVector2 new_position);
294 std::vector<BlamUIWidget*>
children = std::vector<BlamUIWidget*>();
321 void Draw()
override;
325 void SetHidden(
bool new_hidden)
override;
348 int cached_child_count = 0;
358 void Draw()
override;
372 #pragma pack(push, 1)
401 void PreGenerateManualObject();
409 void PostGenerateManualObject();
416 void VerifyManualObjectValid();
420 std::vector<Blam2DVertex>
vertices = std::vector<Blam2DVertex>();
421 std::vector<Blam2DTriangle>
triangles = std::vector<Blam2DTriangle>();
422 std::vector<Blam2DLine>
lines = std::vector<Blam2DLine>();
429 Ogre::SceneNode*
node =
nullptr;
438 BlamColor
color = BlamColor(255, 255, 255);
449 void Draw()
override;
452 void SetHidden(
bool new_hidden)
override;
510 BlamVector2
end = { 0, 0 };
527 void GenerateManualObject()
override;
553 #pragma pack(push, 1)
554 struct Blam2DTextVertex
561 struct Blam2DTextTriangle
569 bgfx::VertexLayout vertex_layout;
570 std::vector<Blam2DTextVertex> vertices = std::vector<Blam2DTextVertex>();
571 std::vector<Blam2DTextTriangle> triangles = std::vector<Blam2DTextTriangle>();
572 bgfx::VertexBufferHandle vertex_buffer = { bgfx::kInvalidHandle };
573 bgfx::IndexBufferHandle index_buffer = { bgfx::kInvalidHandle };
576 Ogre::SceneNode* node =
nullptr;
577 Ogre::ManualObject* manual_object =
nullptr;
579 std::string previous_text =
"";
580 bool last_hide_state =
false;
581 BlamColor last_color = BlamColor(255, 255, 255);
582 BlamColor last_shadow_color = BlamColor(0, 0, 0);
584 std::vector<Ogre::HlmsDatablock*> datablocks = std::vector<Ogre::HlmsDatablock*>();
585 std::vector<Ogre::HlmsDatablock*> shadow_datablocks = std::vector<Ogre::HlmsDatablock*>();
586 bool needs_new_datablocks =
true;
591 void ReleaseOldDatablocks();
596 void GenerateManualObject();
606 void GenerateManualObjectSection(
bool is_shadow);
608 void GenerateManualObjectSection_bgfx(
bool is_shadow);
610 void AddVertex(
float x,
float y,
float uvx,
float uvy,
bool is_shadow =
false);
618 BlamColor
color = BlamColor(255, 255, 255);
627 void Draw()
override;
630 void SetHidden(
bool new_hidden)
override;
@ BottomFill
The widget will fill the bottom of the screen, while height is left unchanged.
@ CenterRight
The widget will be placed at the center-right of the screen.
@ Center
The widget will be placed at the center of the screen.
BLAM void LogEvent(std::string message)
Logs a message to the log and/or console.
Definition: aliases.cpp:130
std::string font_name
The name of the font package to use for this text widget.
Definition: ui.h:620
BlamWidgetAnchor
Enumerator listing possible widget anchor positions.
Definition: ui.h:35
BLAM std::string GetWidgetAnchorLabel(BlamWidgetAnchor anchor_position)
Retrieves a string representation of a widget anchor position.
Definition: ui.cpp:92
IMGUI_API bool Checkbox(const char *label, bool *v)
Definition: imgui_widgets.cpp:974
BLAM BlamUIWidget_Group * GetUIRoot()
Retrieves the root UI group widget.
Definition: ui.cpp:87
Class representing a Blamite font package.
Definition: fonts.h:89
BlamFontPackage * font_package
The font package being used for this text widget.
Definition: ui.h:621
int character_height
The line height of this text widget, in pixels.
Definition: ui.h:616
BlamVector2 shadow_offset
The offset of the text shadow, in pixels.
Definition: ui.h:617
@ Text
A text object, used to show text on-screen.
@ Basic_Rectangle
A basic filled or outline rectangle.
@ Basic_Ellipse
A basic filled or outline ellipse.
IMGUI_API bool InputText(const char *label, char *buf, size_t buf_size, ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition: imgui_widgets.cpp:3068
BLAM int GetRenderHeight()
Retrieves the current height of the viewport.
Definition: bgfx.cpp:428
@ BottomLeft
The widget will be placed at the bottom-left of the screen.
@ Group_VLayout
A group widget which displays all items in a vertical list.
BLAM float * GetGlobalAsFloat(std::string name)
Retrieves a global's value as a float.
Definition: globals.cpp:403
Definition: cui_screen.h:44
unsigned char uint8_t
Definition: stdint.h:15
bool UsingBgfx()
Definition: bgfx.cpp:63
BLAM BlamUIWidget_DebugMenu * GetDebugMenuWidget()
Retrieves the built-in debug menu widget.
Definition: ui.cpp:318
void SetHidden(bool new_hidden) override
Sets the hidden state of the widget.
Definition: text.cpp:678
@ BottomRight
The widget will be placed at the bottom-right of the screen.
BLAM BlamUIWidget_CrashScreen * GetCrashScreenWidget()
Retrieves the built-in crash screen widget.
Definition: ui.cpp:300
@ CenterLeft
The widget will be placed at the center-left of the screen.
IMGUI_API bool DragInt(const char *label, int *v, float v_speed=1.0f, int v_min=0, int v_max=0, const char *format="%d")
Definition: imgui_widgets.cpp:2209
void ShowImGuiPropertyEditor() override
Displays an ImGUI-based property editor.
Definition: text.cpp:119
IMGUI_API void SameLine(float offset_from_start_x=0.0f, float spacing=-1.0f)
Definition: imgui.cpp:7147
@ TopCenter
The widget will be placed at the top-center of the screen.
@ BottomCenter
The widget will be placed at the bottom-center of the screen.
BLAM bool LoadFromCUIScreenTag(std::string tag_path, cui_screen *cusc_tag)
Creates a new UI widget from a cui_screen tag.
Definition: ui.cpp:157
@ RightFill
The widget will fill the right of the screen, while width is left unchanged.
Namespace containing functions relating to the Blamite UI system.
Definition: ui.h:644
~BlamUIWidget_Text()
Definition: text.cpp:47
unsigned long long uint64_t
Definition: stdint.h:18
IMGUI_API bool DragFloat(const char *label, float *v, float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
Definition: imgui_widgets.cpp:2164
void UpdateMetrics() override
Updates metrics for the widget.
Definition: text.cpp:147
IMGUI_API bool DragFloat2(const char *label, float v[2], float v_speed=1.0f, float v_min=0.0f, float v_max=0.0f, const char *format="%.3f", float power=1.0f)
Definition: imgui_widgets.cpp:2169
IMGUI_API bool CollapsingHeader(const char *label, ImGuiTreeNodeFlags flags=0)
Definition: imgui_widgets.cpp:5422
Class for the Blam UI Editor debug utility.
Definition: blam_ui_editor.hpp:11
void Draw() override
Draws the widget on-screen.
Definition: text.cpp:67
@ TopLeft
The widget will be placed at the top-left of the screen.
BLAM bool IsConsoleEnabled()
Checks whether or not the in-game console is enabled.
Definition: engine_definitions.cpp:227
BlamColor color
The text foreground color.
Definition: ui.h:618
font DisplayOffset y
Definition: README.txt:68
BLAM void Render()
Renders all UI to the screen.
Definition: ui.cpp:64
BLAM void Shutdown()
Shuts down the UI system.
Definition: ui.cpp:78
@ TopFill
The widget will fill the top of the screen, while height is left unchanged.
IMGUI_API bool BeginCombo(const char *label, const char *preview_value, ImGuiComboFlags flags=0)
Definition: imgui_widgets.cpp:1416
Definition: material.h:54
BLAM BlamUIWidget_InfoDisplay * GetInfoDisplayWidget()
Retrieves the built-in info display widget.
Definition: ui.cpp:354
@ Basic_Triangle
A basic filled or outline triangle.
Ogre::HlmsDatablock * instance_datablock
The datablock used for this material instance.
Definition: rendering.h:86
Data structure used to store OGRE material instance data.
Definition: rendering.h:82
BlamUIWidget_Text(BlamUIWidget_Group *_parent)
Definition: text.cpp:32
@ Group_HLayout
A group widget which displays all items in a horizontal list.
BLAM int GetRenderHeight()
Retrieves the current height of the OGRE viewport.
Definition: ogre.cpp:685
#define BLAM
Definition: ui.h:19
IMGUI_API bool InputTextMultiline(const char *label, char *buf, size_t buf_size, const ImVec2 &size=ImVec2(0, 0), ImGuiInputTextFlags flags=0, ImGuiInputTextCallback callback=NULL, void *user_data=NULL)
Definition: imgui_widgets.cpp:3074
IMGUI_API void EndCombo()
Definition: imgui_widgets.cpp:1522
BlamUIWidget_Group * ui_root
The UI root widget.
Definition: ui.cpp:16
@ Fill
The widget will fill the entire screen.
std::string text
The text to display within this text widget.
Definition: ui.h:622
@ Group
A group widget, which can be used to contain any number of other widgets.
bool draw_fail_message_shown
Whether or not the "draw failure" message has been displayed. Used to prevent spamming the log if the...
Definition: ui.cpp:17
BlamColor shadow_color
The text shadow color.
Definition: ui.h:619
@ Basic_Line
A basic line.
bool debug_region
Definition: ui.h:614
IMGUI_API void Separator()
Definition: imgui_widgets.cpp:1284
BlamWidgetType
Enumerator listing possible UI widget types.
Definition: ui.h:59
BLAM bool Initialize()
Initializes the UI system.
Definition: ui.cpp:19
config GlyphExtraSpacing x
Definition: README.txt:30
BLAM bool DebugToolsEnabled()
Checks whether or not debug tools are enabled.
Definition: engine_definitions.cpp:209
BLAM Ogre::HlmsDatablock * GetDatablockFromTag(std::string tag_path)
Retrieves an OGRE datablock from a material tag path.
Definition: materials.cpp:950
void RebuildTextObject()
Regenerates the text object.
Definition: text.cpp:255
BLAM ogre_material_instance_data * GetDatablockInstanceFromTag(std::string tag_path, std::string referencing_tag_path)
Retrieves a datablock instance from a material tag path, and a referencing tag path.
Definition: materials.cpp:962
bool auto_scale_shadow
Whether or not to automatically scale the text shadow based on text size.
Definition: ui.h:615
unsigned short uint16_t
Definition: stdint.h:16
BLAM int GetRenderWidth()
Retrieves the current width of the viewport.
Definition: bgfx.cpp:423
BLAM BlamUIWidget_DefaultLoadScreen * GetLoadScreenWidget()
Retrieves the built-in load screen widget.
Definition: ui.cpp:336
@ LeftFill
The widget will fill the left of the screen, while width is left unchanged.
@ Unspecified
Indicates the widget is of an unspecified type. Will only appear when a widget is improperly construc...
IMGUI_API bool Button(const char *label, const ImVec2 &size=ImVec2(0, 0))
Definition: imgui_widgets.cpp:644
@ TopRight
The widget will be placed at the top-right of the screen.
Class representing a Text widget.
Definition: ui.h:550
BLAM int * GetGlobalAsInteger(std::string name)
Retrieves a global's value as an int.
Definition: globals.cpp:391
BLAM int GetRenderWidth()
Retrieves the current width of the OGRE viewport.
Definition: ogre.cpp:680