fix struct win impl

This commit is contained in:
Andrey Zimin 2024-04-01 12:00:20 +03:00
parent d5338c8069
commit 4da6edb89b
5 changed files with 16 additions and 7 deletions

View File

@ -23,14 +23,17 @@ namespace tr::layers
BEGIN_IMGUI_WIN();
{
if (ImGui::Button("RUN", ImVec2(28, 30))) {
if (ImGui::Button("RUN", ImVec2(28, 30)))
{
m_event_manager->execute(std::string("test signal key"), "value params run");
}
TR_PUSH_FONT(ICON, 18);
if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30))) {
if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30)))
{
m_event_manager->execute(std::string("test signal key"), "value params stop");
m_event_manager->execute(std::string("test signal win"), m_win);
}
ImGui::Text(try_engine::style::icon::ICON_PAINT_BRUSH, " Paint" );
@ -57,6 +60,11 @@ namespace tr::layers
{
auto b = std::any_cast<std::string>(e);
hack::log()(b);
if (b == "test signal win")
{
auto w = std::any_cast<win>(value);
hack::log()(w.m_name);
}
}
}

View File

@ -4,6 +4,8 @@
namespace try_engine
{
struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; };
class gui
{
public:

View File

@ -16,9 +16,6 @@ namespace try_engine
layer(const layer&) = delete;
layer(layer&) = delete;
// HERE
// реализовать перемещение слоев
public:
virtual void on_attach() {};
virtual void on_detach() {};

View File

@ -2,6 +2,7 @@
#include "try_engine/utils/utils.hpp"
#include "try_engine/gui/gui.hpp"
#include "try_engine/gui/style/style.hpp"
#include "try_engine/application/application.hpp"

View File

@ -13,7 +13,7 @@
using time = try_engine::time::timestep<float>;\
using event_manager = try_engine::app_event::event;\
using system_event = try_engine::system_event::event;\
struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; } m_win
using win = try_engine::win
#define BASE_WINDOW_FLAGS()\
if (m_flags.m_no_titlebar) m_window_flags |= ImGuiWindowFlags_NoTitleBar;\
@ -73,7 +73,8 @@
private:\
FLAGS_STRUCT_DEFINED();\
private:\
event_manager* m_event_manager
event_manager* m_event_manager;\
win m_win
#define BEGIN_IMGUI_WIN() if (!ImGui::Begin(m_win.m_name.c_str(), &m_flags.m_p_open, m_window_flags)) ImGui::End()