initial commit

This commit is contained in:
Andrey Zimin
2024-05-15 09:09:36 +03:00
commit a0b5e810f7
130 changed files with 4925 additions and 0 deletions

51
src/layer/layer.hpp Executable file
View File

@@ -0,0 +1,51 @@
#pragma once
#include "hack/security/uuid.hpp"
#include "event/event.hpp"
#include "gui/flags.hpp"
namespace VE
{
class layer : public flags
{
using time = time::timestep<float>;
public:
layer() = default;
virtual ~layer() = default;
layer(const layer&) = delete;
void operator=(const layer&) = delete;
public:
virtual void on_attach() {};
virtual void on_detach() {};
virtual void render() {};
virtual void on_event(event e) {};
void set_event_fn(const event_fn<event&>& fn) { execute = fn; };
void begin()
{
ImGui::SetNextWindowPos(mt::convert<ImVec2>(m_passport.m_pos));
ImGui::SetNextWindowSize(mt::convert<ImVec2>(m_passport.m_size));
if (m_passport.m_name.empty())
m_passport.m_name = hack::security::generate_uuid();
if (!ImGui::Begin(m_passport.m_name.c_str(), &m_p_open, m_window_flags)) end();
}
void end() { ImGui::End(); }
protected:
event_fn<event&> execute;
struct passport
{
std::string m_name;
mt::vec2 m_pos;
mt::vec2 m_size;
} m_passport;
};
}