galaxy
1.0.0
Real-Time C++23 Game Programming Framework. Built on data-driven design principles and agile software engineering.
Loading...
Searching...
No Matches
Popup.cpp
Go to the documentation of this file.
1
7
8
#include "
galaxy/ui/ImGuiHelpers.hpp
"
9
10
#include "
Popup.hpp
"
11
12
namespace
galaxy
13
{
14
Popup::Popup
(std::string_view
id
) noexcept
15
:
m_show
{
false
}
16
{
17
m_id = id;
18
}
19
20
Popup::~Popup
() noexcept
21
{
22
}
23
24
void
Popup::draw_button
(
const
char
* text)
noexcept
25
{
26
m_show
= ImGui::Button(text);
27
}
28
29
void
Popup::draw_menuitem
(
const
char
* text)
noexcept
30
{
31
m_show
= ImGui::MenuItem(text);
32
}
33
34
void
Popup::draw
(std::move_only_function<
void
(
void
)>&& func)
35
{
36
if
(
m_show
)
37
{
38
ImGui::OpenPopup(
m_id
.c_str());
39
m_show
=
false
;
40
}
41
42
ui::imgui_center_next_window
();
43
if
(ImGui::BeginPopup(
m_id
.c_str()))
44
{
45
func();
46
ImGui::EndPopup();
47
}
48
}
49
}
// namespace galaxy
ImGuiHelpers.hpp
Popup.hpp
galaxy::Popup::m_id
std::string m_id
Unique id (name) of the popup.
Definition
Popup.hpp:66
galaxy::Popup::m_show
bool m_show
Controls state of popup.
Definition
Popup.hpp:71
galaxy::Popup::draw_menuitem
void draw_menuitem(const char *text) noexcept
Draw a menu button to show the popup.
Definition
Popup.cpp:29
galaxy::Popup::draw_button
void draw_button(const char *text) noexcept
Draw the button to show the popup.
Definition
Popup.cpp:24
galaxy::Popup::Popup
Popup()=delete
Default constructor (deleted).
galaxy::Popup::~Popup
~Popup() noexcept
Destructor.
Definition
Popup.cpp:20
galaxy::Popup::draw
void draw(std::move_only_function< void(void)> &&func)
Show popup.
Definition
Popup.cpp:34
galaxy::ui::imgui_center_next_window
void imgui_center_next_window()
Make sure the next window opened is centered on the monitor.
Definition
ImGuiHelpers.cpp:231
galaxy
Application.hpp galaxy.
Definition
Application.cpp:48
galaxy
src
galaxy
ui
widgets
Popup.cpp
Generated on
for galaxy by
1.18.0