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::SetNextWindowPos(ImVec2(pos_x, pos_y));
|
||||||
ImGui::SetNextWindowSize(ImVec2(width, height));
|
ImGui::SetNextWindowSize(ImVec2(width, height));
|
||||||
|
|
||||||
BEGIN_IMGUI_WIN();
|
BEGIN_IMGUI_WIN("test_win");
|
||||||
|
|
||||||
if (ImGui::Button("RUN", ImVec2(28, 30))) {
|
if (ImGui::Button("RUN", ImVec2(28, 30))) {
|
||||||
em->execute(std::string("asdf"), "asdf");
|
em->execute(std::string("asdf"), "asdf");
|
||||||
|
@ -6,22 +6,10 @@ namespace tr::layers
|
|||||||
{
|
{
|
||||||
class test_panel : public try_engine::layer
|
class test_panel : public try_engine::layer
|
||||||
{
|
{
|
||||||
BASE_TYPE_DEFINE();
|
BASE_IMPL(test_panel);
|
||||||
|
|
||||||
public:
|
|
||||||
CONSTRUCT_IMPL(test_panel);
|
|
||||||
|
|
||||||
public:
|
|
||||||
BASE_OVERIDE_IMPL();
|
|
||||||
|
|
||||||
public:
|
|
||||||
SET_EVENT_MANAGER_IMPL();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
FLAGS_STRUCT_DEFINED();
|
|
||||||
|
|
||||||
bool show = true;
|
bool show = true;
|
||||||
event_manager* em;
|
|
||||||
|
|
||||||
float width = 720.f;
|
float width = 720.f;
|
||||||
float height = 480.f;
|
float height = 480.f;
|
||||||
|
@ -10,7 +10,7 @@ namespace try_engine
|
|||||||
using time = time::timestep<float>;
|
using time = time::timestep<float>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
layer(const std::string& name_) : name { name_ } {};
|
layer() = default;
|
||||||
virtual ~layer() = default;
|
virtual ~layer() = default;
|
||||||
|
|
||||||
layer(const layer&) = delete;
|
layer(const layer&) = delete;
|
||||||
@ -23,10 +23,6 @@ namespace try_engine
|
|||||||
virtual void on_event(system_event::event&) {};
|
virtual void on_event(system_event::event&) {};
|
||||||
virtual void on_event(std::any, std::any) {};
|
virtual void on_event(std::any, std::any) {};
|
||||||
virtual void on_update(time) = 0;
|
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>
|
template<typename Image>
|
||||||
void bind(Image& 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);
|
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;
|
GLuint texture_id = 0;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@
|
|||||||
void on_update(time t) override
|
void on_update(time t) override
|
||||||
|
|
||||||
#define CONSTRUCT_IMPL(name)\
|
#define CONSTRUCT_IMPL(name)\
|
||||||
name() : try_engine::layer { ""#name"" } { BASE_WINDOW_FLAGS(); };\
|
name() : try_engine::layer() { BASE_WINDOW_FLAGS(); };\
|
||||||
~name() = default
|
~name() = default
|
||||||
|
|
||||||
#define FLAGS_STRUCT_DEFINED()\
|
#define FLAGS_STRUCT_DEFINED()\
|
||||||
@ -61,7 +61,22 @@
|
|||||||
} f;\
|
} f;\
|
||||||
ImGuiWindowFlags window_flags = 0
|
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 END_IMGUI_WIN() ImGui::End()
|
||||||
|
|
||||||
#define TR_PUSH_FONT(def_font, def_size)\
|
#define TR_PUSH_FONT(def_font, def_size)\
|
||||||
|
Reference in New Issue
Block a user