#pragma once #define BIT(x)\ (1 << x) #define EVENT_CLASS_TYPE_FN(type)\ virtual std::string get_name() const override { return type; } #define BIND_EVENT_FN(app, x)\ std::bind(&app::x, this, std::placeholders::_1) #define BASE_TYPE_DEFINE(time, event_manager)\ using time = core::time::timestep;\ using event_manager = tr::core::app_event::event;\ using app_event = tr::core::app_event::event_type;\ using system_event = tr::core::system_event::event #define BASE_WINDOW_FLAGS()\ if (f.no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;\ if (f.no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;\ if (!f.no_menu) window_flags |= ImGuiWindowFlags_MenuBar;\ if (f.no_move) window_flags |= ImGuiWindowFlags_NoMove;\ if (f.no_resize) window_flags |= ImGuiWindowFlags_NoResize;\ if (f.no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;\ if (f.no_nav) window_flags |= ImGuiWindowFlags_NoNav;\ if (f.no_background) window_flags |= ImGuiWindowFlags_NoBackground;\ if (f.no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus #define SET_EVENT_MANAGER_IMPL()\ void set_event_manager(event_manager* em_)\ {\ em = em_;\ em->set_event_callback(this);\ } #define BASE_OVERIDE_IMPL()\ void on_attach() override;\ void on_detach() override;\ void gui_render() override;\ void on_event(tr::core::system_event::event& e) override;\ void on_event(tr::core::app_event::event_type type, std::any value) override;\ void on_update(time t) override #define CONSTRUCT_IMPL(name)\ name() : core::layer { ""#name"" } { BASE_WINDOW_FLAGS(); };\ ~name() = default #define FLAGS_STRUCT_DEFINED()\ struct flags\ {\ bool p_open = false;\ bool no_titlebar = true;\ bool no_scrollbar = true;\ bool no_menu = true;\ bool no_move = true;\ bool no_resize = true;\ bool no_collapse = true;\ bool no_nav = false;\ bool no_background = false;\ bool no_bring_to_front = false;\ bool no_docking = true;\ } f;\ ImGuiWindowFlags window_flags = 0 #define BEGIN_IMGUI_WIN() if (!ImGui::Begin(name.c_str(), &f.p_open, window_flags)) ImGui::End() #define END_IMGUI_WIN() ImGui::End()