add example
This commit is contained in:
@@ -2,10 +2,12 @@ inc += include_directories('.')
|
|||||||
|
|
||||||
headers = [
|
headers = [
|
||||||
'ui_layer/ui_layer.hpp',
|
'ui_layer/ui_layer.hpp',
|
||||||
|
'ui_layer_double/ui_layer_double.hpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
sources = [
|
sources = [
|
||||||
'ui_layer/ui_layer.cpp',
|
'ui_layer/ui_layer.cpp',
|
||||||
|
'ui_layer_double/ui_layer_double.cpp',
|
||||||
]
|
]
|
||||||
|
|
||||||
lib = library(
|
lib = library(
|
||||||
|
|||||||
52
example/layers/ui_layer_double/ui_layer_double.cpp
Executable file
52
example/layers/ui_layer_double/ui_layer_double.cpp
Executable file
@@ -0,0 +1,52 @@
|
|||||||
|
#include "ui_layer_double.hpp"
|
||||||
|
|
||||||
|
#include "utils.hpp"
|
||||||
|
|
||||||
|
namespace example
|
||||||
|
{
|
||||||
|
void ui_layer_double::on_attach()
|
||||||
|
{
|
||||||
|
VE::CONNECT(this);
|
||||||
|
|
||||||
|
hack::log()("on_attach");
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_layer_double::render()
|
||||||
|
{
|
||||||
|
ImGui::SetNextWindowPos(ImVec2{ 10.f, 10.f });
|
||||||
|
ImGui::SetNextWindowSize(m_size);
|
||||||
|
|
||||||
|
if (!ImGui::Begin(VE_NAME("Test signal_double"), nullptr, m_win_flags)) ImGui::End();
|
||||||
|
|
||||||
|
VE_PUSH_FONT(REGULAR, 20);
|
||||||
|
if (ImGui::Button("Test signal_double", ImVec2(128, 130)))
|
||||||
|
VE::EMIT(test_event::TEST_EVEN, std::string("test event message ui_layer_double"));
|
||||||
|
VE_POP_FONT();
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_layer_double::on_event(VE::event e)
|
||||||
|
{
|
||||||
|
// для событий от перефирии
|
||||||
|
// if (e.m_type.type() == typeid(VE::event_type))
|
||||||
|
// {
|
||||||
|
// auto t = std::any_cast<VE::event_type>(e.m_type);
|
||||||
|
// if (t != VE::event_type::MOUSE_CURSOR_POSITION)
|
||||||
|
// hack::log()((int)t);
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (e.m_type.type() == typeid(test_event))
|
||||||
|
{
|
||||||
|
auto t = std::any_cast<test_event>(e.m_type);
|
||||||
|
if (t == test_event::TEST_EVEN)
|
||||||
|
hack::log()(std::any_cast<std::string>(e.m_data));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ui_layer_double::update()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
15
example/layers/ui_layer_double/ui_layer_double.hpp
Executable file
15
example/layers/ui_layer_double/ui_layer_double.hpp
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <VE.hpp>
|
||||||
|
|
||||||
|
namespace example
|
||||||
|
{
|
||||||
|
class ui_layer_double : public VE::layer, public VE::flags
|
||||||
|
{
|
||||||
|
VE_OVERIDE();
|
||||||
|
|
||||||
|
ImVec2 m_size = ImVec2{ 400.f, 400.f };
|
||||||
|
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "layers/ui_layer/ui_layer.hpp"
|
#include "layers/ui_layer/ui_layer.hpp"
|
||||||
|
#include "layers/ui_layer_double/ui_layer_double.hpp"
|
||||||
|
|
||||||
namespace example
|
namespace example
|
||||||
{
|
{
|
||||||
@@ -15,7 +16,8 @@ auto main(int argc, char* args[]) -> int
|
|||||||
example::app app{ "vertex_engine_sandbox" };
|
example::app app{ "vertex_engine_sandbox" };
|
||||||
|
|
||||||
app.push_layer(
|
app.push_layer(
|
||||||
new example::ui_layer{}
|
new example::ui_layer{},
|
||||||
|
new example::ui_layer_double{}
|
||||||
);
|
);
|
||||||
app.run();
|
app.run();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user