Compare commits
14 Commits
880ae2da1b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0a57622f67 | |||
| eb0bd80174 | |||
| 5e94a52a5c | |||
| 9f18c9208a | |||
| adbffacd40 | |||
| 27c2e00faa | |||
| 0215e46e4f | |||
| b5ec861332 | |||
| 373111a3eb | |||
| 5b9867506c | |||
| 677ead1195 | |||
| 1d0bb54fae | |||
| 2668ad9944 | |||
| bf25408033 |
12
README.md
12
README.md
@@ -1,13 +1,7 @@
|
|||||||
Движок для OpenCV, OpenGL и ImGui седержащих проектов.
|
Движок для OpenCV, OpenGL и ImGui седержащих проектов.
|
||||||
Пример использования предстален в папке sandbox.
|
Пример использования предстален в папке sandbox.
|
||||||
|
|
||||||
Данный движок используется в проекте Trycaster
|
<p align="center">
|
||||||
для реализации определения психо-эмоционального состояния в видео.
|
<img src="./vertex_engine.gif" width="512" alt="cover">
|
||||||
|
</p>
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
|
|
||||||
// вселенная
|
|
||||||
https://www.youtube.com/watch?v=Pj1P0zV4zDI
|
|
||||||
https://github.com/frozein/VkGalaxy
|
|
||||||
https://beltoforion.de/en/spiral_galaxy_renderer/?a=spiral_galaxy_renderer
|
|
||||||
|
|||||||
@@ -44,17 +44,28 @@ namespace example
|
|||||||
ImGui::SetNextWindowPos(m_pos);
|
ImGui::SetNextWindowPos(m_pos);
|
||||||
ImGui::SetNextWindowSize(m_size);
|
ImGui::SetNextWindowSize(m_size);
|
||||||
|
|
||||||
if (!ImGui::Begin(VE_NAME("Test signal"), nullptr, m_win_flags)) ImGui::End();
|
if (!ImGui::Begin(VE_NO_NAME("Test signal"), nullptr, m_win_flags)) ImGui::End();
|
||||||
|
|
||||||
if (ImGui::Button("Test signal", ImVec2(128, 130)))
|
if (ImGui::Button("Test signal", ImVec2(128, 130)))
|
||||||
EMIT(test_event::TEST_EVEN, std::string("test event message"), 1, "test event log msg");
|
{
|
||||||
|
VE::event e { test_event::TEST_EVEN_1, std::string("test event 1 message"), "asdf-asdf-asdf" };
|
||||||
|
EMIT(e);
|
||||||
|
auto r = e.get_result<std::string>();
|
||||||
|
hack::log()(r);
|
||||||
|
|
||||||
|
e = { test_event::TEST_EVEN_2, std::string("test event 2 message") };
|
||||||
|
EMIT(e);
|
||||||
|
r = e.get_result<std::string>();
|
||||||
|
hack::log()(r);
|
||||||
|
}
|
||||||
|
|
||||||
VE_POP_FONT();
|
VE_POP_FONT();
|
||||||
|
|
||||||
|
|
||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_layer::on_event(VE::event e)
|
void ui_layer::on_event(VE::event& e)
|
||||||
{
|
{
|
||||||
// для событий от перефирии
|
// для событий от перефирии
|
||||||
// if (e.m_type.type() == typeid(VE::event_type))
|
// if (e.m_type.type() == typeid(VE::event_type))
|
||||||
@@ -67,8 +78,11 @@ namespace example
|
|||||||
if (e.m_type.type() == typeid(test_event))
|
if (e.m_type.type() == typeid(test_event))
|
||||||
{
|
{
|
||||||
auto t = std::any_cast<test_event>(e.m_type);
|
auto t = std::any_cast<test_event>(e.m_type);
|
||||||
if (t == test_event::TEST_EVEN)
|
if (t == test_event::TEST_EVEN_1)
|
||||||
|
{
|
||||||
hack::log()(std::any_cast<std::string>(e.m_data));
|
hack::log()(std::any_cast<std::string>(e.m_data));
|
||||||
|
e.m_result = std::string("test_event_1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ namespace example
|
|||||||
class ui_layer : public VE::layer, public VE::flags, public VE::connector
|
class ui_layer : public VE::layer, public VE::flags, public VE::connector
|
||||||
{
|
{
|
||||||
VE_OVERIDE();
|
VE_OVERIDE();
|
||||||
|
VE_EVENT_OVERIDE();
|
||||||
|
|
||||||
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 };
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace example
|
|||||||
CONNECT(this);
|
CONNECT(this);
|
||||||
|
|
||||||
hack::log()("on_attach");
|
hack::log()("on_attach");
|
||||||
|
|
||||||
|
m_win_flags &= ~ImGuiWindowFlags_NoTitleBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_layer_double::on_detach()
|
void ui_layer_double::on_detach()
|
||||||
@@ -26,7 +28,10 @@ namespace example
|
|||||||
|
|
||||||
VE_PUSH_FONT(REGULAR, 20);
|
VE_PUSH_FONT(REGULAR, 20);
|
||||||
if (ImGui::Button("Test signal_double", ImVec2(128, 130)))
|
if (ImGui::Button("Test signal_double", ImVec2(128, 130)))
|
||||||
EMIT(test_event::TEST_EVEN, std::string("test event message ui_layer_double"));
|
{
|
||||||
|
VE::event e { test_event::TEST_EVEN_2, std::string("test event message ui_layer_double") };
|
||||||
|
EMIT(e);
|
||||||
|
}
|
||||||
|
|
||||||
if (ImGui::Button("Test on_detach", ImVec2(128, 130))) on_detach();
|
if (ImGui::Button("Test on_detach", ImVec2(128, 130))) on_detach();
|
||||||
if (ImGui::Button("Test on_attach", ImVec2(128, 130))) on_attach();
|
if (ImGui::Button("Test on_attach", ImVec2(128, 130))) on_attach();
|
||||||
@@ -39,7 +44,7 @@ namespace example
|
|||||||
ImGui::End();
|
ImGui::End();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ui_layer_double::on_event(VE::event e)
|
void ui_layer_double::on_event(VE::event& e)
|
||||||
{
|
{
|
||||||
// для событий от перефирии
|
// для событий от перефирии
|
||||||
// if (e.m_type.type() == typeid(VE::event_type))
|
// if (e.m_type.type() == typeid(VE::event_type))
|
||||||
@@ -52,8 +57,11 @@ namespace example
|
|||||||
if (e.m_type.type() == typeid(test_event))
|
if (e.m_type.type() == typeid(test_event))
|
||||||
{
|
{
|
||||||
auto t = std::any_cast<test_event>(e.m_type);
|
auto t = std::any_cast<test_event>(e.m_type);
|
||||||
if (t == test_event::TEST_EVEN)
|
if (t == test_event::TEST_EVEN_2)
|
||||||
|
{
|
||||||
hack::log()(std::any_cast<std::string>(e.m_data));
|
hack::log()(std::any_cast<std::string>(e.m_data));
|
||||||
|
e.m_result = std::string("test_event_2");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,9 @@ namespace example
|
|||||||
class ui_layer_double : public VE::layer, public VE::flags, public VE::connector
|
class ui_layer_double : public VE::layer, public VE::flags, public VE::connector
|
||||||
{
|
{
|
||||||
VE_OVERIDE();
|
VE_OVERIDE();
|
||||||
|
VE_EVENT_OVERIDE();
|
||||||
|
|
||||||
ImVec2 m_size = ImVec2{ 400.f, 400.f };
|
ImVec2 m_size = ImVec2{ 800.f, 800.f };
|
||||||
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
ImVec2 m_pos = ImVec2{ 400.f, 400.f };
|
||||||
std::string m_key;
|
std::string m_key;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace example
|
|||||||
{
|
{
|
||||||
enum class test_event
|
enum class test_event
|
||||||
{
|
{
|
||||||
TEST_EVEN
|
TEST_EVEN_1,
|
||||||
|
TEST_EVEN_2
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,48 +30,14 @@ namespace VE
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
template <typename TYPE, typename DATA>
|
static void EMIT(event& e)
|
||||||
static void EMIT(TYPE t, DATA d, int id = -1, std::string msg = "")
|
|
||||||
{
|
|
||||||
event e{ t, d, id};
|
|
||||||
if (msg != "") e.m_event_log_message = msg;
|
|
||||||
event_manager::instance().emit(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void EMIT(event e)
|
|
||||||
{
|
{
|
||||||
event_manager::instance().emit(e);
|
event_manager::instance().emit(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void log()
|
virtual void on_event(event& e) {};
|
||||||
{
|
|
||||||
hack::log()("key = ", m_key);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_key;
|
std::string m_key;
|
||||||
};
|
};
|
||||||
|
|
||||||
// template <typename T>
|
|
||||||
// void CONNECT(T* obj)
|
|
||||||
// {
|
|
||||||
// event_manager::instance().connect(obj, &T::on_event);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// template <typename T>
|
|
||||||
// void DISCONNECT(T* obj)
|
|
||||||
// {
|
|
||||||
// event_manager::instance().disconnect(obj, &T::on_event);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// template <typename TYPE, typename DATA>
|
|
||||||
// void EMIT(TYPE t, DATA d, int id = -1)
|
|
||||||
// {
|
|
||||||
// event_manager::instance().emit(event{ t, d, id});
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// inline void EMIT(event e)
|
|
||||||
// {
|
|
||||||
// event_manager::instance().emit(e);
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,38 @@
|
|||||||
#include <any>
|
#include <any>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <hack/security/uuid.hpp>
|
#include <hack/security/uuid.hpp>
|
||||||
|
#include <hack/exception/exception.hpp>
|
||||||
|
#include <hack/logger/logger.hpp>
|
||||||
|
|
||||||
namespace VE
|
namespace VE
|
||||||
{
|
{
|
||||||
struct event
|
struct event
|
||||||
{
|
{
|
||||||
event(std::any type, std::any data, std::size_t id) : m_type{ type }, m_data{ data }, m_id { id } {}
|
event(std::any type, std::any data, std::string id = hack::security::generate_uuid()) : m_type{ type }, m_data{ data }, m_id { id } {}
|
||||||
~event() = default;
|
~event() = default;
|
||||||
|
|
||||||
std::any m_type;
|
std::any m_type;
|
||||||
std::any m_data;
|
std::any m_data;
|
||||||
std::size_t m_id;
|
std::any m_result;
|
||||||
|
std::string m_id;
|
||||||
std::string m_event_log_message;
|
std::string m_event_log_message;
|
||||||
std::string m_event_id = hack::security::generate_uuid();
|
std::string m_event_id = hack::security::generate_uuid();
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
T get_result()
|
||||||
|
{
|
||||||
|
T r;
|
||||||
|
try { r = std::any_cast<T>(m_result); }
|
||||||
|
catch(std::exception& e)
|
||||||
|
{
|
||||||
|
hack::exception ex;
|
||||||
|
ex.service(e.what());
|
||||||
|
ex.description("dont convert type any_cast");
|
||||||
|
hack::error()(ex);
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
|
return r;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ namespace VE
|
|||||||
struct event_manager : public hack::patterns::singleton<event_manager>
|
struct event_manager : public hack::patterns::singleton<event_manager>
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
std::string connect(T* obj, void (T::*method)(event))
|
std::string connect(T* obj, void (T::*method)(event&))
|
||||||
{
|
{
|
||||||
std::string key = hack::security::generate_uuid();
|
std::string key = hack::security::generate_uuid();
|
||||||
m_funcs[key] = std::bind(method, obj, std::placeholders::_1);
|
m_funcs[key] = std::bind(method, obj, std::placeholders::_1);
|
||||||
@@ -25,7 +25,7 @@ namespace VE
|
|||||||
m_funcs.erase(it);
|
m_funcs.erase(it);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emit(event e)
|
void emit(event& e)
|
||||||
{
|
{
|
||||||
if (m_funcs.size() == 0)
|
if (m_funcs.size() == 0)
|
||||||
{
|
{
|
||||||
@@ -60,86 +60,3 @@ namespace VE
|
|||||||
std::map<std::string, event_fn<event>> m_funcs;
|
std::map<std::string, event_fn<event>> m_funcs;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma once
|
|
||||||
//
|
|
||||||
// #include <functional>
|
|
||||||
// #include <hack/patterns/singleton.hpp>
|
|
||||||
// #include <hack/logger/logger.hpp>
|
|
||||||
// #include <hack/security/uuid.hpp>
|
|
||||||
// #include <hack/exception/exception.hpp>
|
|
||||||
//
|
|
||||||
// #include "event.hpp"
|
|
||||||
//
|
|
||||||
// namespace VE
|
|
||||||
// {
|
|
||||||
// struct event_manager : public hack::patterns::singleton<event_manager>
|
|
||||||
// {
|
|
||||||
// void emit(event e)
|
|
||||||
// {
|
|
||||||
// if (m_funcs.size() == 0)
|
|
||||||
// {
|
|
||||||
// hack::warn()("funs is empty");
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// else if (!e.m_msg.empty())
|
|
||||||
// {
|
|
||||||
// hack::warn()("EMIT MSG:", e.m_msg, m_funcs.size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// std::size_t i = 0;
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// for(;i < m_funcs.size();++i) m_funcs[i].m_func(e);
|
|
||||||
// }
|
|
||||||
// catch(std::exception& ext)
|
|
||||||
// {
|
|
||||||
// hack::error()("call function is error:", ext.what());
|
|
||||||
// hack::exception ex;
|
|
||||||
// ex.system_error(ext);
|
|
||||||
// ex.set_data(e);
|
|
||||||
// throw ex;
|
|
||||||
// }
|
|
||||||
// catch(...)
|
|
||||||
// {
|
|
||||||
// hack::error()("call function is error:", "oopps...");
|
|
||||||
// hack::exception ex;
|
|
||||||
// ex.set_data(e);
|
|
||||||
// throw ex;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// template<typename T>
|
|
||||||
// void connect(T* obj, void (T::*method)(event))
|
|
||||||
// {
|
|
||||||
// m_funcs.push_back({
|
|
||||||
// std::bind(method, obj, std::placeholders::_1),
|
|
||||||
// static_cast<void*>(obj)
|
|
||||||
// });
|
|
||||||
// hack::warn()("connect (size)", m_funcs.size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// template<typename T>
|
|
||||||
// void disconnect(T* obj, void (T::*method)(event))
|
|
||||||
// {
|
|
||||||
// m_funcs.erase(
|
|
||||||
// std::remove_if(m_funcs.begin(), m_funcs.end(),
|
|
||||||
// [obj](const auto& handler) {
|
|
||||||
// return handler.m_obj == obj;
|
|
||||||
// }),
|
|
||||||
// m_funcs.end()
|
|
||||||
// );
|
|
||||||
// hack::warn()("disconnect (size)", m_funcs.size());
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// struct EventHandler
|
|
||||||
// {
|
|
||||||
// std::function<void(event)> m_func;
|
|
||||||
// void* m_obj;
|
|
||||||
// };
|
|
||||||
//
|
|
||||||
// std::vector<EventHandler> m_funcs;
|
|
||||||
//
|
|
||||||
// };
|
|
||||||
// }
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
#include "context.hpp"
|
#include "context.hpp"
|
||||||
|
|
||||||
|
#include "vertex_engine/utils/define.hpp" // IWYU pragma: keep
|
||||||
|
|
||||||
namespace VE
|
namespace VE
|
||||||
{
|
{
|
||||||
context::context(GLFWwindow* w) : m_win { w }
|
context::context(GLFWwindow* w) : m_win { w }
|
||||||
@@ -7,12 +9,12 @@ namespace VE
|
|||||||
glfwMakeContextCurrent(m_win);
|
glfwMakeContextCurrent(m_win);
|
||||||
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
|
||||||
|
|
||||||
hack::log(": ")("Glad loader status", status == 1 ? "Load" : "UNLOAD");
|
hack::log()("Glad loader status:", status == 1 ? "Load" : "UNLOAD");
|
||||||
hack::log(": ")("OpenGL Info");
|
hack::log()("OpenGL Info:");
|
||||||
hack::log(": ")(" Vendor", glGetString(GL_VENDOR));
|
hack::log()(" Vendor:", VE_GLGETSTRING(GL_VENDOR));
|
||||||
hack::log(": ")(" Renderer", glGetString(GL_RENDERER));
|
hack::log()(" Renderer:", VE_GLGETSTRING(GL_RENDERER));
|
||||||
hack::log(": ")(" Version", glGetString(GL_VERSION));
|
hack::log()(" Version:", VE_GLGETSTRING(GL_VERSION));
|
||||||
hack::log(": ")(" GLSL Version", glGetString(GL_SHADING_LANGUAGE_VERSION));
|
hack::log()(" GLSL Version:", VE_GLGETSTRING(GL_SHADING_LANGUAGE_VERSION));
|
||||||
|
|
||||||
glfwSwapInterval(1);
|
glfwSwapInterval(1);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace VE
|
|||||||
|
|
||||||
glfw::~glfw()
|
glfw::~glfw()
|
||||||
{
|
{
|
||||||
hack::warn(": ")("Destroy glfw window", m_win_data.m_name);
|
hack::warn()("Destroy glfw window:", m_win_data.m_name);
|
||||||
glfwDestroyWindow(m_win);
|
glfwDestroyWindow(m_win);
|
||||||
glfwTerminate();
|
glfwTerminate();
|
||||||
}
|
}
|
||||||
@@ -67,9 +67,9 @@ namespace VE
|
|||||||
|
|
||||||
glfwGetWindowSize(m_win, &m_win_data.m_width, &m_win_data.m_height);
|
glfwGetWindowSize(m_win, &m_win_data.m_width, &m_win_data.m_height);
|
||||||
|
|
||||||
hack::log(": ")("Created glfw window", m_win_data.m_name);
|
hack::log()("Created glfw window:", m_win_data.m_name);
|
||||||
hack::log(" = ")(" width", m_win_data.m_width);
|
hack::log()(" width =", m_win_data.m_width);
|
||||||
hack::log(" = ")(" height", m_win_data.m_height);
|
hack::log()(" height =", m_win_data.m_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
void glfw::set_graphic_context()
|
void glfw::set_graphic_context()
|
||||||
@@ -124,17 +124,20 @@ namespace VE
|
|||||||
{
|
{
|
||||||
case GLFW_PRESS:
|
case GLFW_PRESS:
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::KEY_PRESSED, key);
|
event e { event_type::KEY_PRESSED, key };
|
||||||
|
connector::EMIT(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GLFW_RELEASE:
|
case GLFW_RELEASE:
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::KEY_RELEASED, key);
|
event e { event_type::KEY_RELEASED, key };
|
||||||
|
connector::EMIT(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GLFW_REPEAT:
|
case GLFW_REPEAT:
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::KEY_REPEATE, key);
|
event e { event_type::KEY_REPEATE, key };
|
||||||
|
connector::EMIT(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,16 +158,23 @@ namespace VE
|
|||||||
std::chrono::duration<double, std::milli> duration = local - time;
|
std::chrono::duration<double, std::milli> duration = local - time;
|
||||||
|
|
||||||
if (duration.count() > 10 && duration.count() < 200)
|
if (duration.count() > 10 && duration.count() < 200)
|
||||||
connector::EMIT(event_type::MOUSE_BUTTON_DOUBLE_PRESSED, button);
|
{
|
||||||
|
event e { event_type::MOUSE_BUTTON_DOUBLE_PRESSED, button };
|
||||||
|
connector::EMIT(e);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
connector::EMIT(event_type::MOUSE_BUTTON_PRESSED, button);
|
{
|
||||||
|
event e { event_type::MOUSE_BUTTON_PRESSED, button };
|
||||||
|
connector::EMIT(e);
|
||||||
|
}
|
||||||
|
|
||||||
time = local;
|
time = local;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GLFW_RELEASE:
|
case GLFW_RELEASE:
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::MOUSE_BUTTON_RELEASED, button);
|
event e { event_type::MOUSE_BUTTON_RELEASED, button };
|
||||||
|
connector::EMIT(e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,11 +185,12 @@ namespace VE
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto data = std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) };
|
auto data = std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) };
|
||||||
connector::EMIT(event_type::MOUSE_SCROLL, data);
|
event e { event_type::MOUSE_SCROLL, data };
|
||||||
|
connector::EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::log()("VE_ERROR: ", e.what());
|
hack::log()("VE_ERROR:", e.what());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -188,11 +199,12 @@ namespace VE
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto data = std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) };
|
auto data = std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) };
|
||||||
connector::EMIT(event_type::MOUSE_CURSOR_POSITION, data);
|
event e { event_type::MOUSE_CURSOR_POSITION, data };
|
||||||
|
connector::EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::log()("VE_ERROR: ", e.what());
|
hack::log()("VE_ERROR:", e.what());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -210,11 +222,12 @@ namespace VE
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto data = std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) };
|
auto data = std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) };
|
||||||
connector::EMIT(event_type::WINDOW_RESIZE, data);
|
event e { event_type::WINDOW_RESIZE, data };
|
||||||
|
connector::EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::log()("VE_ERROR: ", e.what());
|
hack::log()("VE_ERROR:", e.what());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -222,11 +235,12 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::WINDOW_CLOSE, nullptr);
|
event e { event_type::WINDOW_CLOSE, nullptr };
|
||||||
|
connector::EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::log()("VE_ERROR: ", e.what());
|
hack::log()("VE_ERROR:", e.what());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -234,11 +248,12 @@ namespace VE
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
connector::EMIT(event_type::WINDOW_FOCUS, focused);
|
event e { event_type::WINDOW_FOCUS, focused };
|
||||||
|
connector::EMIT(e);
|
||||||
}
|
}
|
||||||
catch(std::exception& e)
|
catch(std::exception& e)
|
||||||
{
|
{
|
||||||
hack::log()("VE_ERROR: ", e.what());
|
hack::log()("VE_ERROR:", e.what());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,6 @@ namespace VE
|
|||||||
virtual void on_detach() {};
|
virtual void on_detach() {};
|
||||||
virtual void render() {};
|
virtual void render() {};
|
||||||
virtual void update() {};
|
virtual void update() {};
|
||||||
virtual void on_event(event e) {};
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
event_fn<event> execute;
|
event_fn<event> execute;
|
||||||
|
|||||||
@@ -112,10 +112,10 @@ namespace VE
|
|||||||
if (compale == GL_FALSE)
|
if (compale == GL_FALSE)
|
||||||
{
|
{
|
||||||
glGetShaderInfoLog(shader, 1024, NULL, info);
|
glGetShaderInfoLog(shader, 1024, NULL, info);
|
||||||
hack::error("")("shader compale error: ", type_to_name(type), info);
|
hack::error()("shader compale error:", type_to_name(type), info);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
hack::log("")("shader compale is good: ", type_to_name(type));
|
hack::log()("shader compale is good:", type_to_name(type));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,24 @@
|
|||||||
#define BIT(x)\
|
#define BIT(x)\
|
||||||
(1 << x)
|
(1 << x)
|
||||||
|
|
||||||
|
#define VE_EVENT_OVERIDE()\
|
||||||
|
public:\
|
||||||
|
void on_event(VE::event& e) override
|
||||||
|
|
||||||
#define VE_OVERIDE()\
|
#define VE_OVERIDE()\
|
||||||
public:\
|
public:\
|
||||||
void on_attach() override;\
|
void on_attach() override;\
|
||||||
void on_detach() override;\
|
void on_detach() override;\
|
||||||
void render() override;\
|
void render() override;\
|
||||||
void update() override;\
|
void update() override
|
||||||
void on_event(VE::event e) override
|
|
||||||
|
|
||||||
#define VE_PUSH_FONT(def_font, def_size)\
|
#define VE_PUSH_FONT(def_font, def_size)\
|
||||||
ImGui::PushFont(VE::style::fonts::get_font(VE::style::fonts::font_type::def_font, def_size))
|
ImGui::PushFont(VE::style::fonts::get_font(VE::style::fonts::font_type::def_font, def_size))
|
||||||
#define VE_POP_FONT() ImGui::PopFont()
|
#define VE_POP_FONT() ImGui::PopFont()
|
||||||
|
|
||||||
#define VE_NAME(n) VE::func::name(n).data()
|
#define VE_NO_NAME(n) VE::func::name(n).data()
|
||||||
|
#define VE_NAME(n) VE::func::name(n, "").data()
|
||||||
|
|
||||||
#define VE_COLOR(c, t) VE::func::color(c, t)
|
#define VE_COLOR(c, t) VE::func::color(c, t)
|
||||||
|
|
||||||
|
#define VE_GLGETSTRING(n) reinterpret_cast<const char*>(glGetString(n))
|
||||||
|
|||||||
@@ -5,9 +5,9 @@
|
|||||||
|
|
||||||
namespace VE::func
|
namespace VE::func
|
||||||
{
|
{
|
||||||
inline auto name(std::string n)
|
inline auto name(std::string n, std::string key_no_name = "##")
|
||||||
{
|
{
|
||||||
return "##" + n;
|
return key_no_name + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ImU32 color(std::string hex, unsigned char alpha = 255)
|
inline ImU32 color(std::string hex, unsigned char alpha = 255)
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
namespace VE
|
namespace VE
|
||||||
{
|
{
|
||||||
template<typename Event>
|
template<typename Event>
|
||||||
using event_fn = std::function<void(Event)>;
|
using event_fn = std::function<void(Event&)>;
|
||||||
|
|
||||||
template<typename Layer>
|
template<typename Layer>
|
||||||
using layers_stack = std::vector<Layer*>;
|
using layers_stack = std::vector<Layer*>;
|
||||||
|
|||||||
18
subprojects/glfw.wrap
Executable file → Normal file
18
subprojects/glfw.wrap
Executable file → Normal file
@@ -1,13 +1,13 @@
|
|||||||
[wrap-file]
|
[wrap-file]
|
||||||
directory = glfw-3.3.7
|
directory = glfw-3.4
|
||||||
source_url = https://github.com/glfw/glfw/archive/refs/tags/3.3.7.tar.gz
|
source_url = https://github.com/glfw/glfw/archive/refs/tags/3.4.tar.gz
|
||||||
source_filename = glfw-3.3.7.tar.gz
|
source_filename = glfw-3.4.tar.gz
|
||||||
source_hash = fd21a5f65bcc0fc3c76e0f8865776e852de09ef6fbc3620e09ce96d2b2807e04
|
source_hash = c038d34200234d071fae9345bc455e4a8f2f544ab60150765d7704e08f3dac01
|
||||||
patch_filename = glfw_3.3.7-1_patch.zip
|
patch_filename = glfw_3.4-1_patch.zip
|
||||||
patch_url = https://wrapdb.mesonbuild.com/v2/glfw_3.3.7-1/get_patch
|
patch_url = https://wrapdb.mesonbuild.com/v2/glfw_3.4-1/get_patch
|
||||||
patch_hash = cfc19fedadd1492f1bcf4a7e7604c81398571a696f94f3d18992060caf6b7057
|
patch_hash = 58a6a6cdb28195d7f7e6f5de85dff7044d378e49b46bf1d4a9b04c97ed93e6b0
|
||||||
wrapdb_version = 3.3.7-1
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glfw_3.4-1/glfw-3.4.tar.gz
|
||||||
|
wrapdb_version = 3.4-1
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
glfw3 = glfw_dep
|
glfw3 = glfw_dep
|
||||||
|
|
||||||
|
|||||||
17
subprojects/glm.wrap
Executable file → Normal file
17
subprojects/glm.wrap
Executable file → Normal file
@@ -1,12 +1,13 @@
|
|||||||
[wrap-file]
|
[wrap-file]
|
||||||
directory = glm-0.9.9.8
|
directory = glm-1.0.1
|
||||||
source_url = https://github.com/g-truc/glm/archive/0.9.9.8.tar.gz
|
source_url = https://github.com/g-truc/glm/archive/refs/tags/1.0.1.tar.gz
|
||||||
source_filename = 0.9.9.8.tar.gz
|
source_filename = glm-1.0.1.tar.gz
|
||||||
source_hash = 7d508ab72cb5d43227a3711420f06ff99b0a0cb63ee2f93631b162bfe1fe9592
|
source_hash = 9f3174561fd26904b23f0db5e560971cbf9b3cbda0b280f04d5c379d03bf234c
|
||||||
patch_url = https://wrapdb.mesonbuild.com/v2/glm_0.9.9.8-2/get_patch
|
patch_filename = glm_1.0.1-1_patch.zip
|
||||||
patch_filename = glm-0.9.9.8-2-wrap.zip
|
patch_url = https://wrapdb.mesonbuild.com/v2/glm_1.0.1-1/get_patch
|
||||||
patch_hash = d930a1fcd3a28d84be4e92cc4c71ff59e170a1ebbd3dbfce631eba19e478d83d
|
patch_hash = 25679275e26bc4c36bb617d1b4a52197039402af828d2a4bf67b3c0260a5df6a
|
||||||
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/glm_1.0.1-1/glm-1.0.1.tar.gz
|
||||||
|
wrapdb_version = 1.0.1-1
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
glm = glm_dep
|
glm = glm_dep
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
[wrap-git]
|
[wrap-git]
|
||||||
url = https://gitcast.ru/chatlanin/hack.git
|
url = chatlanin@gitcast.ru:chatlanin/hack.git
|
||||||
revision = master
|
revision = master
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
|
|||||||
@@ -3,11 +3,11 @@ directory = imgui-1.91.6
|
|||||||
source_url = https://github.com/ocornut/imgui/archive/refs/tags/v1.91.6.tar.gz
|
source_url = https://github.com/ocornut/imgui/archive/refs/tags/v1.91.6.tar.gz
|
||||||
source_filename = imgui-1.91.6.tar.gz
|
source_filename = imgui-1.91.6.tar.gz
|
||||||
source_hash = c5fbc5dcab1d46064001c3b84d7a88812985cde7e0e9ced03f5677bec1ba502a
|
source_hash = c5fbc5dcab1d46064001c3b84d7a88812985cde7e0e9ced03f5677bec1ba502a
|
||||||
patch_filename = imgui_1.91.6-2_patch.zip
|
patch_filename = imgui_1.91.6-3_patch.zip
|
||||||
patch_url = https://wrapdb.mesonbuild.com/v2/imgui_1.91.6-2/get_patch
|
patch_url = https://wrapdb.mesonbuild.com/v2/imgui_1.91.6-3/get_patch
|
||||||
patch_hash = 515e31b18e3928aafce2c62c94fa6d8426f5132e9c3f2d9951b7e96b6381f33a
|
patch_hash = 2f7977114ba07d06559aaf8890a92a4ebd25186592d4447954605aaf2244634d
|
||||||
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/imgui_1.91.6-2/imgui-1.91.6.tar.gz
|
source_fallback_url = https://github.com/mesonbuild/wrapdb/releases/download/imgui_1.91.6-3/imgui-1.91.6.tar.gz
|
||||||
wrapdb_version = 1.91.6-2
|
wrapdb_version = 1.91.6-3
|
||||||
|
|
||||||
[provide]
|
[provide]
|
||||||
imgui = imgui_dep
|
imgui = imgui_dep
|
||||||
|
|||||||
Reference in New Issue
Block a user