Blamite Game Engine - blam!  00296.01.12.21.0102.blamite
The core library for the Blamite Game Engine.
dx11_window.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "../../debug_ui.h"
4 
6 {
14  {
15  private:
16  bool show_another_window = false;
17  bool show_test_window = false;
18 
19  public:
26  {
27  return &show_test_window;
28  }
29 
33  void Draw()
34  {
36  // Begin Built-in ImGui testing windows //
38 
39  //Show a simple window
40  // Tip: if we don't call ImGui::Begin()/ImGui::End() the widgets appears in a window automatically called "Debug"
41  if (show)
42  {
43  static float f = 0.0f;
44  ImGui::Text("Hello, world!");
45  ImGui::SliderFloat("float", &f, 0.0f, 1.0f);
46 
48  {
49  ImGui::ColorEdit3("clear color", (float*)BlamRendering::DirectX::GetClearColor());
50  }
51  else
52  {
53  BlamColor* clear_color = Blam::Globals::GetGlobalAsColor("clear_col");
54  ImVec4 clear_col_imgui = ImVec4(clear_color->GetRedAsFloat(), clear_color->GetGreenAsFloat(), clear_color->GetBlueAsFloat(), clear_color->GetAlphaAsFloat());
55 
56  ImGui::ColorEdit3("clear color", (float*)&clear_col_imgui);
57 
58  BlamColor new_clear_color = BlamColor(clear_col_imgui.x * 255.0f, clear_col_imgui.y * 255.0f, clear_col_imgui.z * 255.0f, clear_col_imgui.w * 255.0f);
59 
60  Blam::Globals::UpdateGlobal("clear_col", new_clear_color);
61  }
62 
63  if (ImGui::Button("Test Window")) show_test_window ^= 1;
64  if (ImGui::Button("Render Clearing")) *BlamRendering::DirectX::RenderTargetClearing() ^= 1;
65  if (ImGui::Checkbox("Read-only", BlamRendering::DirectX::RenderTargetClearing()));
66  if (ImGui::Button("Another Window")) show_another_window ^= 1;
67  if (ImGui::Button("Menu Bar")) *duigvs("devtools_bar") ^= 1;
68  /*if (ImGui::Button("Render Clearing")) enable_render_target_clear ^= 1;*/
69  ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate, ImGui::GetIO().Framerate);
70  }
71 
72  //Show another simple window, this time using an explicit Begin/End pair
73  if (show_another_window)
74  {
75  ImGui::SetNextWindowSize(ImVec2(200, 100)/*, ImGuiSetCond_FirstUseEver*/);
76  ImGui::Begin("Another Window", &show_another_window);
77  ImGui::Text("Hello");
78  ImGui::End();
79  }
80 
81  //Show the ImGui test window. Most of the sample code is in ImGui::ShowTestWindow()
82  if (show_test_window)
83  {
84  //ImGui::SetNextWindowPos(ImVec2(650, 20)/*, ImGuiSetCond_FirstUseEver*/); // Normally user code doesn't need/want to call it because positions are saved in .ini file anyway. Here we just want to make the demo initial state a bit more friendly!
85  //ImGui::ShowTestWindow(&show_test_window);
86  ImGui::ShowDemoWindow(&show_test_window);
87  }
88 
90  // END Built-in ImGui testing windows //
92  }
93  };
94 }
BlamRendering::DirectX::GetClearColor
BLAM ImVec4 * GetClearColor()
Retrieves the current color used to clear the render target.
Definition: render_manage.cpp:613
Blam::DebugUI::Windows::DirectX11Window::ShowTestWindow
bool * ShowTestWindow()
Retrieves whether or not the window should be drawn.
Definition: dx11_window.hpp:25
BlamRendering::GetCurrentRenderingEngine
BLAM BlamRenderingEngine GetCurrentRenderingEngine()
Retrieves the current rendering engine being used.
Definition: rendering_abstraction.cpp:103
Blam::DebugUI::Windows::DirectX11Window
Class for the default ImGUI DX11 sample window.
Definition: dx11_window.hpp:13
clear_color
BlamColor * clear_color
Definition: opengl.cpp:21
Blam::Globals::GetGlobalAsColor
BLAM BlamColor * GetGlobalAsColor(std::string name)
Retrieves a global's value as a BlamColor.
Definition: globals.cpp:412
Blam::DebugUI::ImGUIDrawingGroup::show
bool show
Controls whether or not the group should be shown. May not be used in all groups.
Definition: debug_ui.h:362
Blam::DebugUI::Windows::DirectX11Window::Draw
void Draw()
Draws the window, as well as the demo window and the "Another Window" if they are enabled.
Definition: dx11_window.hpp:33
Blam::DebugUI::ImGUIDrawingGroup
Class representing an ImGUI drawing group/draw list item.
Definition: debug_ui.h:359
DirectX11
@ DirectX11
Definition: rendering.h:25
Blam::DebugUI::Windows
Legacy namespace to contain data for the legacy ImGUI console.
Definition: debug_ui.h:434
Text
@ Text
Master text object that wraps around both BitmapText and DWText.
Definition: render_stack.h:73
BlamRendering::DirectX::RenderTargetClearing
BLAM bool * RenderTargetClearing()
Retrieves whether or not to enable render target clearing.
Definition: render_manage.cpp:608
duigvs
#define duigvs(x)
Macro for Blam::DebugUI::GetVisibility().
Definition: debug_ui.h:19
Blam::Globals::UpdateGlobal
BLAM GvarUpdateResult UpdateGlobal(std::string name, std::string new_value)
Updates the value of a String global.
Definition: globals.cpp:571