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

55
src/glfw/glfw.hpp Executable file
View File

@@ -0,0 +1,55 @@
#pragma once
#include "utils/utils.hpp"
#include "context/context.hpp"
#include "event/event.hpp"
namespace VE
{
class glfw
{
public:
// HERE
// реализовать остальные конструкторы
glfw();
~glfw();
private:
// ни каких unique_ptr тут не получится
// т.к. glfwCreateWindow maloc-ом выделяет память
// что не есть хорошо для умных указателей
GLFWwindow* m_win;
std::unique_ptr<context> m_context;
mt::vec4 m_bgcolor = { 0.1f, 0.1f, 0.1f, 1.f };
struct win_data
{
std::string m_name;
int m_width, m_height;
event_fn<event&> execute; // в using.hpp
} m_win_data;
public:
void init(std::string win_name);
GLFWwindow* get_win() const;
int width() const;
int height() const;
void update();
void clear() const;
void set_event_fn(const event_fn<event&>& fn);
private:
void set_hint();
void set_window();
void set_graphic_context();
void set_pointer();
void set_key_callback();
void set_mouse_callback();
void set_window_callback();
};
}