add remder permit
This commit is contained in:
@@ -85,7 +85,7 @@ namespace sandbox
|
|||||||
|
|
||||||
class opengl_panel : public VE::layer
|
class opengl_panel : public VE::layer
|
||||||
{
|
{
|
||||||
VE_FN_OVERIDE();
|
VE_FN_OVERIDE(opengl_panel, true);
|
||||||
|
|
||||||
cube m_cb_1;
|
cube m_cb_1;
|
||||||
cube m_cb_2;
|
cube m_cb_2;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ namespace sandbox
|
|||||||
{
|
{
|
||||||
void test_panel::on_attach()
|
void test_panel::on_attach()
|
||||||
{
|
{
|
||||||
hack::log()("on_attach");
|
hack::log()("on_attach", VE::application::get()->get_glfw()->width());
|
||||||
}
|
}
|
||||||
|
|
||||||
void test_panel::on_detach()
|
void test_panel::on_detach()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace sandbox
|
|||||||
{
|
{
|
||||||
class test_panel : public VE::layer
|
class test_panel : public VE::layer
|
||||||
{
|
{
|
||||||
VE_FN_OVERIDE();
|
VE_FN_OVERIDE(test_panel, false);
|
||||||
|
|
||||||
ImVec2 m_size = ImVec2{ 600.f, 100.f };
|
ImVec2 m_size = ImVec2{ 600.f, 100.f };
|
||||||
ImVec2 m_pos = ImVec2{ 100.f, 100.f };
|
ImVec2 m_pos = ImVec2{ 100.f, 100.f };
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ namespace sandbox
|
|||||||
{
|
{
|
||||||
class test_panel_2 : public VE::layer
|
class test_panel_2 : public VE::layer
|
||||||
{
|
{
|
||||||
VE_FN_OVERIDE();
|
VE_FN_OVERIDE(test_panel_2, true);
|
||||||
|
|
||||||
ImVec2 m_size = ImVec2{ 400.f, 400.f };
|
ImVec2 m_size = ImVec2{ 400.f, 400.f };
|
||||||
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace VE
|
|||||||
m_glfw->clear();
|
m_glfw->clear();
|
||||||
|
|
||||||
m_gui->begin_frame();
|
m_gui->begin_frame();
|
||||||
for (auto l : m_layers_stack) l->render();
|
for (auto l : m_layers_stack) if (l->m_render_permit) l->render();
|
||||||
m_gui->end_frame();
|
m_gui->end_frame();
|
||||||
|
|
||||||
m_glfw->update();
|
m_glfw->update();
|
||||||
|
|||||||
@@ -91,14 +91,12 @@ namespace VE
|
|||||||
|
|
||||||
int glfw::width() const
|
int glfw::width() const
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(m_win));
|
return m_win_data.m_width;
|
||||||
return d->m_width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int glfw::height() const
|
int glfw::height() const
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(m_win));
|
return m_win_data.m_height;
|
||||||
return d->m_height;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void glfw::update()
|
void glfw::update()
|
||||||
@@ -200,8 +198,10 @@ namespace VE
|
|||||||
glfwSetWindowSizeCallback(m_win, [](GLFWwindow* w, int width, int height)
|
glfwSetWindowSizeCallback(m_win, [](GLFWwindow* w, int width, int height)
|
||||||
{
|
{
|
||||||
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
|
||||||
|
hack::log()(d->m_width);
|
||||||
d->m_width = width;
|
d->m_width = width;
|
||||||
d->m_height = height;
|
d->m_height = height;
|
||||||
|
hack::log()(d->m_width);
|
||||||
|
|
||||||
event e{ event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
event e{ event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
|
||||||
d->execute(e);
|
d->execute(e);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace VE
|
|||||||
using time = time::timestep<float>;
|
using time = time::timestep<float>;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
layer() = default;
|
layer(bool p) : m_render_permit { p } {}
|
||||||
virtual ~layer() = default;
|
virtual ~layer() = default;
|
||||||
|
|
||||||
layer(const layer&) = delete;
|
layer(const layer&) = delete;
|
||||||
@@ -24,6 +24,11 @@ namespace VE
|
|||||||
|
|
||||||
void set_event_fn(const event_fn<event&>& fn) { execute = fn; };
|
void set_event_fn(const event_fn<event&>& fn) { execute = fn; };
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Внекоторых случаях необходимо чтобы компонент был в системе сигналов, но не
|
||||||
|
// в системе отрисовки. Например при вкладках.
|
||||||
|
bool m_render_permit;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
event_fn<event&> execute;
|
event_fn<event&> execute;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,7 +6,9 @@
|
|||||||
#define VE_EVENT_FN\
|
#define VE_EVENT_FN\
|
||||||
std::bind(&application::on_event, this, std::placeholders::_1)
|
std::bind(&application::on_event, this, std::placeholders::_1)
|
||||||
|
|
||||||
#define VE_FN_OVERIDE()\
|
#define VE_FN_OVERIDE(def_class_name, def_render_permit)\
|
||||||
|
public:\
|
||||||
|
def_class_name() : VE::layer { def_render_permit } {}\
|
||||||
public:\
|
public:\
|
||||||
void on_attach() override;\
|
void on_attach() override;\
|
||||||
void on_detach() override;\
|
void on_detach() override;\
|
||||||
|
|||||||
Reference in New Issue
Block a user