add base implementation define and imgui window name
This commit is contained in:
parent
84f01e1f41
commit
81fbfeffbb
0
.projectile
Normal file
0
.projectile
Normal file
@ -19,7 +19,7 @@ namespace tr::layers
|
||||
ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y));
|
||||
ImGui::SetNextWindowSize(ImVec2(width, height));
|
||||
|
||||
BEGIN_IMGUI_WIN();
|
||||
BEGIN_IMGUI_WIN("test_win");
|
||||
|
||||
if (ImGui::Button("RUN", ImVec2(28, 30))) {
|
||||
em->execute(std::string("asdf"), "asdf");
|
||||
|
@ -6,22 +6,10 @@ namespace tr::layers
|
||||
{
|
||||
class test_panel : public try_engine::layer
|
||||
{
|
||||
BASE_TYPE_DEFINE();
|
||||
|
||||
public:
|
||||
CONSTRUCT_IMPL(test_panel);
|
||||
|
||||
public:
|
||||
BASE_OVERIDE_IMPL();
|
||||
|
||||
public:
|
||||
SET_EVENT_MANAGER_IMPL();
|
||||
BASE_IMPL(test_panel);
|
||||
|
||||
private:
|
||||
FLAGS_STRUCT_DEFINED();
|
||||
|
||||
bool show = true;
|
||||
event_manager* em;
|
||||
|
||||
float width = 720.f;
|
||||
float height = 480.f;
|
||||
|
@ -10,7 +10,7 @@ namespace try_engine
|
||||
using time = time::timestep<float>;
|
||||
|
||||
public:
|
||||
layer(const std::string& name_) : name { name_ } {};
|
||||
layer() = default;
|
||||
virtual ~layer() = default;
|
||||
|
||||
layer(const layer&) = delete;
|
||||
@ -23,10 +23,6 @@ namespace try_engine
|
||||
virtual void on_event(system_event::event&) {};
|
||||
virtual void on_event(std::any, std::any) {};
|
||||
virtual void on_update(time) = 0;
|
||||
const std::string& get_name() const { return name; };
|
||||
|
||||
protected:
|
||||
std::string name;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,9 @@ namespace try_engine
|
||||
template<typename Image>
|
||||
void bind(Image& image)
|
||||
{
|
||||
// HERE наяинаем тут
|
||||
// возможно эту штуку нужно делать сразу полсе make
|
||||
// либо перенеси ее в make
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.cols, image.rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.data);
|
||||
}
|
||||
|
||||
@ -25,3 +28,4 @@ namespace try_engine
|
||||
GLuint texture_id = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -41,7 +41,7 @@
|
||||
void on_update(time t) override
|
||||
|
||||
#define CONSTRUCT_IMPL(name)\
|
||||
name() : try_engine::layer { ""#name"" } { BASE_WINDOW_FLAGS(); };\
|
||||
name() : try_engine::layer() { BASE_WINDOW_FLAGS(); };\
|
||||
~name() = default
|
||||
|
||||
#define FLAGS_STRUCT_DEFINED()\
|
||||
@ -61,7 +61,22 @@
|
||||
} f;\
|
||||
ImGuiWindowFlags window_flags = 0
|
||||
|
||||
#define BEGIN_IMGUI_WIN() if (!ImGui::Begin(name.c_str(), &f.p_open, window_flags)) ImGui::End()
|
||||
|
||||
#define BASE_IMPL(name)\
|
||||
BASE_TYPE_DEFINE();\
|
||||
public:\
|
||||
CONSTRUCT_IMPL(name);\
|
||||
public:\
|
||||
BASE_OVERIDE_IMPL();\
|
||||
public:\
|
||||
SET_EVENT_MANAGER_IMPL();\
|
||||
private:\
|
||||
FLAGS_STRUCT_DEFINED();\
|
||||
private:\
|
||||
event_manager* em
|
||||
|
||||
|
||||
#define BEGIN_IMGUI_WIN(name) if (!ImGui::Begin(name, &f.p_open, window_flags)) ImGui::End()
|
||||
#define END_IMGUI_WIN() ImGui::End()
|
||||
|
||||
#define TR_PUSH_FONT(def_font, def_size)\
|
||||
|
Reference in New Issue
Block a user