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

12
.gitignore vendored Executable file
View File

@ -0,0 +1,12 @@
build
.cache
subprojects/*
!subprojects/glad.wrap
!subprojects/glfw.wrap
!subprojects/glm.wrap
!subprojects/gtest.wrap
!subprojects/hack.wrap
!subprojects/imgui.wrap
!subprojects/nlohmann_json.wrap
!subprojects/taglib.wrap

11
README.md Executable file
View File

@ -0,0 +1,11 @@
Движок для OpenCV, OpenGL и ImGui седержащих проектов.
Пример использования предстален в папке sandbox.
Данный движок используется в проекте Trycaster
для реализации определения психо-эмоционального состояния в видео.
![video present](./try_engine.gif)
// вселенная
https://www.youtube.com/watch?v=Pj1P0zV4zDI

26
bin/layers/meson.build Executable file
View File

@ -0,0 +1,26 @@
inc += include_directories('.')
headers = [
'test_panel/test_panel.hpp',
'test_panel_2/test_panel_2.hpp',
'opengl_panel/opengl_panel.hpp',
]
sources = [
'test_panel/test_panel.cpp',
'test_panel_2/test_panel_2.cpp',
'opengl_panel/opengl_panel.cpp',
]
lib = library(
'vertex_engine_sandbox',
include_directories : inc,
sources: [headers, sources],
dependencies : deps,
cpp_args: args
)
deps += declare_dependency(
include_directories: inc,
link_with: lib,
)

View File

@ -0,0 +1,107 @@
#include "opengl_panel.hpp"
#include "utils.hpp"
namespace sandbox
{
cube::cube()
{
hack::log()("create cube");
const std::filesystem::path vsp { "/mnt/raid/projects/vertex_engine/bin/layers/opengl_panel/shaders/vertes.shader" };
const std::filesystem::path fsp { "/mnt/raid/projects/vertex_engine/bin/layers/opengl_panel/shaders/frag.shader" };
add_shader(GL_VERTEX_SHADER, vsp);
add_shader(GL_FRAGMENT_SHADER, fsp);
shader_program::link();
m_vertices =
{
-0.1f, 0.0f, 0.7f,
0.1f, 0.0f, 0.7f,
0.1f, 0.0f, -0.7f,
-0.1f, 0.0f, -0.7f,
0.0f, 0.3f, 0.0f
};
m_indices =
{
0, 1, 1, 4, 4, 0,
0, 3, 3, 4, 4, 2,
2, 1, 3, 2
};
buffer::link();
}
void cube::use() { shader_program::use(); }
void cube::set_scale(float val) { set("scale", val); }
void cube::set_position(glm::vec3 val) { set("position", val); }
void cube::set_color(glm::vec4 val) { set("color", val); }
void cube::render() { buffer::render(); }
void opengl_panel::on_attach()
{
hack::log()("on_attach");
}
void opengl_panel::on_detach()
{
hack::log()("on_attach");
}
void opengl_panel::render()
{
// glm::mat4 view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
// glm::mat4 projection = glm::perspective(glm::radians(45.0f), 800.0f / 600.0f, 0.1f, 100.0f);
cb_1.use();
// unsigned int viewLoc = glGetUniformLocation(cb_1.get_id(), "view");
// glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(view));
// unsigned int projLoc = glGetUniformLocation(cb_1.get_id(), "projection");
// glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(projection));
float r = std::sin(glfwGetTime());
float g = std::cos(glfwGetTime());
cb_1.set_color(glm::vec4{ 0.85f, 0.45f, 0.95f, 0.f }); // розовый
cb_1.set_scale(1.0f + std::sin(glfwGetTime()) * 0.2f);
cb_1.set_position(glm::vec3{ 0.f, 0.5, 0.f });
cb_1.render();
r = std::cos(glfwGetTime());
g = std::sin(glfwGetTime());
cb_2.use();
// unsigned int viewLoc_1 = glGetUniformLocation(cb_2.get_id(), "view");
// glUniformMatrix4fv(viewLoc_1, 1, GL_FALSE, glm::value_ptr(view));
// unsigned int projLoc_1 = glGetUniformLocation(cb_2.get_id(), "projection");
// glUniformMatrix4fv(projLoc_1, 1, GL_FALSE, glm::value_ptr(projection));
cb_2.set_color(glm::vec4{ 0.66f, 0.66f, 0.66f, 0.f }); // серый/белый
cb_2.set_scale(1.0f - std::cos(glfwGetTime()) * 0.2f);
cb_2.set_position(glm::vec3{ r, g, 0.f });
cb_2.render();
}
void opengl_panel::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));
}
}
}

View File

@ -0,0 +1,30 @@
#pragma once
#include "VE.hpp"
namespace sandbox
{
class cube : public VE::opengl
{
public:
cube();
~cube() = default;
public:
void set_scale(float val);
void set_position(glm::vec3 val);
void set_color(glm::vec4 val);
void use();
void render();
};
class opengl_panel : public VE::layer
{
VE_FN_OVERIDE();
cube cb_1;
cube cb_2;
};
}

View File

@ -0,0 +1,9 @@
#version 330 core
in vec4 v_color;
out vec4 f_color;
void main()
{
f_color = v_color;
}

View File

@ -0,0 +1,22 @@
#version 330 core
layout (location = 0) in vec3 base_position;
uniform float scale;
uniform vec4 color;
uniform vec3 position;
uniform mat4 view;
uniform mat4 model;
uniform mat4 projection;
out vec4 v_color;
void main()
{
vec3 p = base_position + position * scale ;
// gl_Position = projection * view * vec4(p, 1.0);
gl_Position = vec4(p, 1.0);
v_color = color;
}

View File

@ -0,0 +1,40 @@
#include "test_panel.hpp"
#include "utils.hpp"
namespace sandbox
{
void test_panel::on_attach()
{
hack::log()("on_attach");
// set layer params
// m_passport.m_name = "test_panel";
m_passport.m_size = mt::vec2{ 600.f, 100.f };
m_passport.m_pos = mt::vec2{ 100.f, 100.f };
// устанавливаем/убираем флаги отличные от установки по умолчанию
// в данном примере убираем флаг
m_window_flags &= ~ImGuiWindowFlags_NoTitleBar;
}
void test_panel::on_detach()
{
hack::log()("on_attach");
}
void test_panel::render()
{
begin();
if (ImGui::Button("RUN", ImVec2(28, 30)))
{
VE::event e { test_event::TEST_EVEN , std::string("test event message") };
execute(e);
}
end();
}
void test_panel::on_event(VE::event e)
{
}
}

View File

@ -0,0 +1,12 @@
#pragma once
#include "VE.hpp"
namespace sandbox
{
class test_panel : public VE::layer
{
VE_FN_OVERIDE();
};
}

View File

@ -0,0 +1,63 @@
#include "test_panel_2.hpp"
#include "utils.hpp"
namespace sandbox
{
void test_panel_2::on_attach()
{
hack::log()("on_attach");
// set layer params
// m_passport.m_name = "test_panel";
m_passport.m_size = mt::vec2{ 400.f, 400.f };
m_passport.m_pos = mt::vec2{ 400.f, 400.f };
}
void test_panel_2::on_detach()
{
hack::log()("on_attach");
}
void test_panel_2::render()
{
begin();
if (ImGui::Button("RUN", ImVec2(28, 30)))
{
VE::event e { test_event::TEST_EVEN , std::string("test event message") };
execute(e);
}
VE_PUSH_FONT(ICON, 18);
if (ImGui::Button(VE::style::icon::ICON_STOP, ImVec2(28, 30)))
{
VE::event e { test_event::TEST_EVEN , std::string("test icon button") };
execute(e);
}
ImGui::Text(VE::style::icon::ICON_PAINT_BRUSH, " Paint" );
ImGui::Text("\xef\x87\xbc");
VE_POP_FONT();
end();
}
void test_panel_2::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));
}
}
}

View File

@ -0,0 +1,12 @@
#pragma once
#include "VE.hpp"
namespace sandbox
{
class test_panel_2 : public VE::layer
{
VE_FN_OVERIDE();
};
}

11
bin/layers/utils.hpp Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#include <typeinfo>
namespace sandbox
{
enum class test_event
{
TEST_EVEN
};
}

42
bin/main.cpp Executable file
View File

@ -0,0 +1,42 @@
#include "layers/test_panel/test_panel.hpp"
#include "layers/test_panel_2/test_panel_2.hpp"
#include "layers/opengl_panel/opengl_panel.hpp"
namespace sandbox
{
class test_app : public VE::application
{
public:
test_app(std::string app_name) : VE::application{ app_name } {};
~test_app() = default;
public:
template<typename... Args>
void push_layer(Args... args)
{
this->VE::application::push_layer(args...);
}
};
}
namespace VE
{
inline application& create()
{
static sandbox::test_app e{ "sandbox" };
e.push_layer(
new sandbox::test_panel{},
new sandbox::test_panel_2{},
new sandbox::opengl_panel{}
);
return e;
}
}
auto main(int argc, char* args[]) -> int
{
decltype(auto) app = VE::create();
app.run();
}

6
bin/meson.build Executable file
View File

@ -0,0 +1,6 @@
executable(
meson.project_name(),
'main.cpp',
dependencies : deps,
cpp_args: args
)

55
meson.build Executable file
View File

@ -0,0 +1,55 @@
project(
meson.current_source_dir().split('/').get(-1),
'cpp',
version : '1.0.0',
default_options : [
'warning_level=1',
'optimization=3',
'cpp_std=c++20',
])
add_project_arguments (
'-Wall',
'-Wpedantic',
'-Wno-shadow',
'-Wno-unused-but-set-variable',
'-Wno-comment',
'-Wno-unused-parameter',
'-Wno-unused-value',
'-Wno-unused-header',
'-Wno-missing-field-initializers',
'-Wno-narrowing',
'-Wno-deprecated-enum-enum-conversion',
'-Wno-volatile',
'-Wno-format-security',
'-Wno-switch',
'-Wno-ignored-attributes',
'-Wno-unused-variable',
language: 'cpp'
)
#############################################################
#args = [ '-lsndfile', '-lmpg123', '-lopenal', '-lglfw', '-ldl', '-lGL', '-lpthread', '-lX11', '-lXxf86vm', '-lXrandr', '-lXi']
args = [ ]
deps = [
dependency('uuid'),
dependency('threads'),
dependency('opengl'),
subproject('glfw').get_variable('glfw_dep'),
subproject('glad').get_variable('glad_dep'),
subproject('hack').get_variable('hack_dep'),
subproject('imgui').get_variable('imgui_dep'),
subproject('nlohmann_json').get_variable('nlohmann_json_dep'),
subproject('glm').get_variable('glm_dep'),
]
inc = []
#############################################################
subdir('src')
subdir('bin/layers')
subdir('bin')
#subdir('tests')

21
run.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/zsh
PROJECT_NAME=$(basename $PWD)
run() {
command meson compile -C build
if [[ -z "$1" ]]; then
cd build
./bin/$PROJECT_NAME
cd ..
else
meson test $1 -C build
fi
}
if [ -d "build" ]; then
run
else
command meson setup build
run
fi

7
src/TMP/bin/main.cpp Executable file
View File

@ -0,0 +1,7 @@
#include "sandbox/sandbox.hpp"
auto main(int argc, char* args[]) -> int
{
decltype(auto) app = try_engine::create();
app.run();
}

6
src/TMP/bin/meson.build Executable file
View File

@ -0,0 +1,6 @@
executable(
'try_engine',
'main.cpp',
dependencies : deps,
cpp_args: args
)

4
src/TMP/src/meson.build Executable file
View File

@ -0,0 +1,4 @@
inc += include_directories('.')
subdir('try_engine')
subdir('sandbox')

View File

@ -0,0 +1,70 @@
#include "test_panel.hpp"
namespace tr::layers
{
void test_panel::on_attach()
{
BASE_WINDOW_FLAGS();
m_win.m_pos = { 212.f, 35.f };
m_win.m_size = { 720.f, 480.f };
m_win.m_name = "test_win";
}
void test_panel::on_detach()
{
}
void test_panel::gui_render()
{
ImGui::SetNextWindowPos(m_win.m_pos);
ImGui::SetNextWindowSize(m_win.m_size);
BEGIN_IMGUI_WIN();
{
if (ImGui::Button("RUN", ImVec2(28, 30)))
{
m_event_manager->execute(std::string("test signal key"), "value params run");
}
TR_PUSH_FONT(ICON, 18);
if (ImGui::Button(try_engine::style::icon::ICON_STOP, ImVec2(28, 30)))
{
m_event_manager->execute(std::string("test signal key"), "value params stop");
m_event_manager->execute(std::string("test signal win"), m_win);
}
ImGui::Text(try_engine::style::icon::ICON_PAINT_BRUSH, " Paint" );
ImGui::Text("\xef\x87\xbc");
TR_POP_FONT();
}
END_IMGUI_WIN();
}
void test_panel::on_event(system_event& e)
{
if (e.get_name() == try_engine::system_event::classificator::KEY_PRESSED())
{
auto t = static_cast<try_engine::system_event::key_pressed_event&>(e);
if (t.get_keycode() == try_engine::key::J)
hack::log()("Ok this is J");
}
}
void test_panel::on_event(std::any e, std::any value)
{
auto b = std::any_cast<std::string>(e);
hack::log()(b);
if (b == "test signal win")
{
auto w = std::any_cast<win>(value);
hack::log()(w.m_name);
}
}
}

View File

@ -0,0 +1,15 @@
#pragma once
#include "try_engine/try_engine.hpp"
namespace tr::layers
{
class test_panel : public try_engine::layer
{
BASE_IMPL(test_panel);
private:
bool m_open = true;
};
}

23
src/TMP/src/sandbox/meson.build Executable file
View File

@ -0,0 +1,23 @@
headers = [
'sandbox.hpp',
'layers/test_panel/test_panel.hpp'
]
sources = [
'layers/test_panel/test_panel.cpp'
]
lib = library(
'sandbox',
include_directories : inc,
sources: [headers, sources],
dependencies : deps,
cpp_args: args
)
sandbox_dep = declare_dependency(
include_directories: inc,
link_with: lib,
)
deps += sandbox_dep

40
src/TMP/src/sandbox/sandbox.hpp Executable file
View File

@ -0,0 +1,40 @@
#include "layers/test_panel/test_panel.hpp"
namespace try_engine_sandbox
{
class sandbox : public try_engine::application
{
using event_manager = try_engine::app_event::event;
public:
sandbox(std::string app_name) : try_engine::application{ app_name } {};
~sandbox() = default;
public:
template<typename... Args>
void push_layer(Args... args)
{
(args->set_event_manager(&m_event_manager), ...);
try_engine::application::push_layer(args...);
}
private:
event_manager m_event_manager;
};
}
namespace try_engine
{
inline application& create()
{
static try_engine_sandbox::sandbox e{ "sandbox" };
e.push_layer(
new tr::layers::test_panel{}
);
e.attach_layers();
return e;
}
}

View File

@ -0,0 +1,51 @@
#include "application.hpp"
#include "try_engine/utils/utils.hpp"
namespace try_engine
{
application::application(std::string app_name)
{
instance = std::unique_ptr<application>(this);
m_win = std::make_unique<window>(app_name);
m_win->set_event_callback(BIND_EVENT_FN(application, on_event));
m_gui = std::make_unique<gui>();
}
void application::run()
{
while(!glfwWindowShouldClose(m_win->glfw_window()))
{
m_win->clear();
m_gui->begin_frame();
for (auto l : m_layers_stack)
l->gui_render();
m_gui->end_frame();
m_win->update();
}
}
std::unique_ptr<window>& application::get_window()
{
return m_win;
}
std::unique_ptr<application>& application::get()
{
return instance;
}
void application::attach_layers()
{
for (auto l : m_layers_stack) l->on_attach();
}
void application::on_event(system_event::event& e)
{
for(const auto l : m_layers_stack) l->on_event(e);
}
}

View File

@ -0,0 +1,41 @@
#pragma once
#include "try_engine/window/window.hpp"
#include "try_engine/gui/gui.hpp"
#include "try_engine/layer/layer.hpp"
namespace try_engine
{
class application
{
using layers_stack = std::vector<layer*>;
public:
application(std::string);
virtual ~application() = default;
private:
inline static std::unique_ptr<application> instance = nullptr;
std::unique_ptr<window> m_win;
layers_stack m_layers_stack;
std::unique_ptr<gui> m_gui;
public:
void run();
void attach_layers();
std::unique_ptr<window>& get_window();
static std::unique_ptr<application>& get();
public:
template<typename... Args>
void push_layer(Args*... args) { (m_layers_stack.push_back(args), ...); }
private:
void clear();
void on_event(system_event::event& e);
};
// реализация см. в проекте
application& create();
}

View File

@ -0,0 +1,49 @@
#pragma once
#include <oneapi/tbb/parallel_for.h>
#include "try_engine/layer/layer.hpp"
namespace try_engine::app_event
{
using layers_stack = std::vector<layer*>;
class event
{
public:
void set_event_callback(layer* l)
{
l_stack.push_back(l);
};
void execute(std::any type, std::any value)
{
for (const auto layer : l_stack)
{
std::thread th {
[=]() {
layer->on_event(type, value);
}
};
th.detach();
}
// tbb::parallel_for(tbb::blocked_range<int>(0, l_stack.size()), [&](tbb::blocked_range<int> r) {
// for (int i = r.begin(); i < r.end(); ++i)
// l_stack[i]->on_event(type, value);
// });
}
// когда нужно выполнение именно по очередности
void execute_queue(std::any type, std::any value)
{
for (const auto layer : l_stack)
layer->on_event(type, value);
}
void print_size();
private:
layers_stack l_stack;
};
}

View File

@ -0,0 +1,40 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "try_engine/event/system_event/event.hpp"
#include "try_engine/event/system_event/classificator.hpp"
namespace try_engine::system_event
{
class key_event : public event
{
// HERE
// ???
protected:
key_event(int kc) : m_keycode { kc } {}
protected:
int m_keycode;
public:
inline int get_keycode() const { return m_keycode; }
};
class key_pressed_event : public key_event
{
public:
key_pressed_event(int keycode) : key_event(keycode) {}
public:
EVENT_CLASS_TYPE_FN(classificator::KEY_PRESSED())
};
class key_released_event : public key_event
{
public:
key_released_event(int keycode) : key_event(keycode) {}
public:
EVENT_CLASS_TYPE_FN(classificator::KEY_RELEASED())
};
}

View File

@ -0,0 +1,94 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "try_engine/event/system_event/event.hpp"
#include "try_engine/event/system_event/classificator.hpp"
namespace try_engine::system_event
{
// class MouseMovedEvent : public Event
// {
// public:
// MouseMovedEvent(float x, float y) : m_MouseX(x), m_MouseY(y) {}
//
// inline float GetX() const { return m_MouseX; }
// inline float GetY() const { return m_MouseY; }
//
// std::string ToString() const override
// {
// std::stringstream ss;
// ss << "MouseMovedEvent: " << m_MouseX << ", " << m_MouseY;
// return ss.str();
// }
//
// EVENT_CLASS_TYPE(MouseMoved)
// EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
//
// private:
// float m_MouseX, m_MouseY;
// };
//
// class MouseScrolledEvent : public Event
// {
// public:
// MouseScrolledEvent(float xOffset, float yOffset) : m_XOffset(xOffset), m_YOffset(yOffset) {}
//
// inline float GetXOffset() const { return m_XOffset; }
// inline float GetYOffset() const { return m_YOffset; }
//
// std::string ToString() const override
// {
// std::stringstream ss;
// ss << "MouseScrolledEvent: " << GetXOffset() << ", " << GetYOffset();
// return ss.str();
// }
//
// EVENT_CLASS_TYPE(MouseScrolled)
// EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
//
// private:
// float m_XOffset, m_YOffset;
// };
// class MouseButtonEvent : public Event
// {
// public:
// inline int GetMouseButton() const { return m_Button; }
// EVENT_CLASS_CATEGORY(EventCategoryMouse | EventCategoryInput)
//
// protected:
// MouseButtonEvent(int button) : m_Button(button) {}
// int m_Button;
// };
//
// class MouseButtonPressedEvent : public MouseButtonEvent
// {
// public:
// MouseButtonPressedEvent(int button) : MouseButtonEvent(button) {}
//
// std::string ToString() const override
// {
// std::stringstream ss;
// ss << "MouseButtonPressedEvent: " << m_Button;
// return ss.str();
// }
//
// EVENT_CLASS_TYPE(MouseButtonPressed)
// };
//
// class MouseButtonReleasedEvent : public MouseButtonEvent
// {
// public:
// MouseButtonReleasedEvent(int button) : MouseButtonEvent(button) {}
//
// std::string ToString() const override
// {
// std::stringstream ss;
// ss << "MouseButtonReleasedEvent: " << m_Button;
// return ss.str();
// }
//
// EVENT_CLASS_TYPE(MouseButtonReleased)
// };
}

View File

@ -0,0 +1,49 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "try_engine/event/system_event/event.hpp"
#include "try_engine/event/system_event/classificator.hpp"
namespace try_engine::system_event
{
class window_resize_event : public event
{
public:
window_resize_event(int w, int h) : m_width { w }, m_height { h } {}
private:
int m_width, m_height;
public:
EVENT_CLASS_TYPE_FN(classificator::WINDOW_RESIZE())
public:
inline unsigned int get_width() const { return m_width; }
inline unsigned int get_height() const { return m_height; }
};
class window_close_event : public event
{
public:
window_close_event() = default;
public:
EVENT_CLASS_TYPE_FN(classificator::WINDOW_CLOSE())
};
class window_focus_event : public event
{
public:
window_focus_event(int f) : m_focused { f } {}
private:
int m_focused;
public:
EVENT_CLASS_TYPE_FN(classificator::WINDOW_FOCUS())
public:
inline int get_focused() { return m_focused; }
};
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "try_engine/utils/utils.hpp"
namespace try_engine::system_event::classificator
{
inline std::string WINDOW_RESIZE() { return "WINDOW_RESIZE"; }
inline std::string WINDOW_CLOSE() { return "WINDOW_CLOSE"; }
inline std::string WINDOW_FOCUS() { return "WINDOW_FOCUS"; }
inline std::string KEY_PRESSED() { return "KEY_PRESSED"; }
inline std::string KEY_RELEASED() { return "KEY_RELEASED"; }
}

View File

@ -0,0 +1,13 @@
#pragma once
#include "hack/utils/utils.hpp"
namespace try_engine::system_event
{
struct event
{
event() = default;
virtual ~event() = default;
virtual std::string get_name() const = 0;
};
}

View File

@ -0,0 +1,62 @@
#include "gui.hpp"
#include "style/style.hpp"
#include "try_engine/application/application.hpp"
namespace try_engine
{
gui::gui()
{
// HERE
// откуда она ???
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.IniFilename = nullptr;
ImGuiStyle& style = ImGui::GetStyle();
if (io.ConfigFlags)
{
style.WindowRounding = 0.0f;
style.Colors[ImGuiCol_WindowBg].w = 1.0f;
}
auto& app = application::get();
GLFWwindow* window = app->get_window()->glfw_window();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 410");
style::init();
}
gui::~gui()
{
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void gui::begin_frame()
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
}
void gui::end_frame()
{
ImGuiIO& io = ImGui::GetIO();
auto& app = application::get();
io.DisplaySize = ImVec2((float)app->get_window()->width(), (float)app->get_window()->height());
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "try_engine/utils/utils.hpp"
namespace try_engine
{
struct win { ImVec2 m_pos { 0.f, 0.f }; ImVec2 m_size { 0.f, 0.f }; std::string m_name; };
class gui
{
public:
gui();
~gui();
public:
void begin_frame();
void end_frame();
};
}

View File

@ -0,0 +1,103 @@
#pragma once
#include <string>
#include <vector>
#include <map>
#include "imgui.h"
#include "icons.hpp"
namespace try_engine::style::fonts
{
inline std::string font_name = "Montserrat/Montserrat-";
inline std::vector<float> font_size = { 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f };
enum font_type
{
BOLD, BOLD_ITALIC, EXTRA_BOLD, EXTRA_BOLD_ITALIC, EXTRA_LIGHT, EXTRA_LIGHT_ITALIC,
ITALIC, LIGHT, LIGHT_ITALIC, MEDIUM, MEDIUM_ITALIC, REGULAR, SEMI_BOLD, SEMI_BOLD_ITALIC, THIN, THIN_ITALIC, ICON
};
// HERE
// эту порнографию с путями нужно решить
inline const std::string ICONS_PATH = "/mnt/raid/projects/cpp/try_engine/src/try_engine/internal/fonts/FontAwesome/forkawesome-webfont.ttf";
inline const std::string FONT_PATH = "/mnt/raid/projects/cpp/try_engine/src/try_engine/internal/fonts/";
inline std::vector<std::string> fonts_path
{
FONT_PATH + font_name + "Bold.ttf",
FONT_PATH + font_name + "BoldItalic.ttf",
FONT_PATH + font_name + "ExtraBold.ttf",
FONT_PATH + font_name + "ExtraBoldItalic.ttf",
FONT_PATH + font_name + "ExtraLight.ttf",
FONT_PATH + font_name + "ExtraLightItalic.ttf",
FONT_PATH + font_name + "Italic.ttf",
FONT_PATH + font_name + "Light.ttf",
FONT_PATH + font_name + "LightItalic.ttf",
FONT_PATH + font_name + "Medium.ttf",
FONT_PATH + font_name + "MediumItalic.ttf",
FONT_PATH + font_name + "Regular.ttf",
FONT_PATH + font_name + "SemiBold.ttf",
FONT_PATH + font_name + "SemiBoldItalic.ttf",
FONT_PATH + font_name + "Thin.ttf",
FONT_PATH + font_name + "ThinItalic.ttf"
};
inline std::map<font_type, int> font_step
{
{ font_type::BOLD, 0 },
{ font_type::BOLD_ITALIC, 15 },
{ font_type::EXTRA_BOLD, 30 },
{ font_type::EXTRA_BOLD_ITALIC, 45 },
{ font_type::EXTRA_LIGHT, 60 },
{ font_type::EXTRA_LIGHT_ITALIC, 75 },
{ font_type::ITALIC, 90 },
{ font_type::LIGHT, 105 },
{ font_type::LIGHT_ITALIC, 120 },
{ font_type::MEDIUM, 135 },
{ font_type::MEDIUM_ITALIC, 150 },
{ font_type::REGULAR, 165 },
{ font_type::SEMI_BOLD, 180 },
{ font_type::SEMI_BOLD_ITALIC, 195 },
{ font_type::THIN, 210 },
{ font_type::THIN_ITALIC, 225 },
{ font_type::ICON, 240 },
};
inline void init()
{
ImGuiIO& io = ImGui::GetIO();
for (auto& p : fonts_path)
for (auto size : font_size)
io.Fonts->AddFontFromFileTTF(p.c_str(), size, NULL, io.Fonts->GetGlyphRangesCyrillic());
// add icon font size
static const ImWchar icon_ranges[] = { ICON_MIN_FK, ICON_MAX_FK, 0 };
for (auto size : font_size)
io.Fonts->AddFontFromFileTTF(ICONS_PATH.c_str(), size, NULL, icon_ranges);
};
inline ImFont* get_font(font_type type = font_type::REGULAR, int size = 16)
{
if (size < 0) size = 8;
if (size > 33) size = 33;
size -= 8; // т.к. font_size начинается с 8.f
ImGuiIO& io = ImGui::GetIO();
ImFontAtlas* atlas = io.Fonts;
auto pos = font_step[type] + size;
return atlas->Fonts[pos];
};
}

View File

@ -0,0 +1,719 @@
#pragma once
// for use with https://github.com/ForkAwesome/Fork-Awesome/blob/master/fonts/forkawesome-webfont.ttf
#define ICON_MIN_FK 0xf000
#define ICON_MAX_FK 0xf307
namespace try_engine::style::icon
{
inline const char* ICON_GLASS = "\uf000";
inline const char* ICON_MUSIC = "\uf001";
inline const char* ICON_SEARCH = "\uf002";
inline const char* ICON_ENVELOPE_O = "\uf003";
inline const char* ICON_HEART = "\uf004";
inline const char* ICON_STAR = "\uf005";
inline const char* ICON_STAR_O = "\uf006";
inline const char* ICON_USER = "\uf007";
inline const char* ICON_FILM = "\uf008";
inline const char* ICON_TH_LARGE = "\uf009";
inline const char* ICON_TH = "\uf00a";
inline const char* ICON_TH_LIST = "\uf00b";
inline const char* ICON_CHECK = "\uf00c";
inline const char* ICON_TIMES = "\uf00d";
inline const char* ICON_SEARCH_PLUS = "\uf00e";
inline const char* ICON_SEARCH_MINUS = "\uf010";
inline const char* ICON_POWER_OFF = "\uf011";
inline const char* ICON_SIGNAL = "\uf012";
inline const char* ICON_COG = "\uf013";
inline const char* ICON_TRASH_O = "\uf014";
inline const char* ICON_HOME = "\uf015";
inline const char* ICON_FILE_O = "\uf016";
inline const char* ICON_CLOCK_O = "\uf017";
inline const char* ICON_ROAD = "\uf018";
inline const char* ICON_DOWNLOAD = "\uf019";
inline const char* ICON_ARROW_CIRCLE_O_DOWN = "\uf01a";
inline const char* ICON_ARROW_CIRCLE_O_UP = "\uf01b";
inline const char* ICON_INBOX = "\uf01c";
inline const char* ICON_PLAY_CIRCLE_O = "\uf01d";
inline const char* ICON_REPEAT = "\uf01e";
inline const char* ICON_REFRESH = "\uf021";
inline const char* ICON_LIST_ALT = "\uf022";
inline const char* ICON_LOCK = "\uf023";
inline const char* ICON_FLAG = "\uf024";
inline const char* ICON_HEADPHONES = "\uf025";
inline const char* ICON_VOLUME_OFF = "\uf026";
inline const char* ICON_VOLUME_DOWN = "\uf027";
inline const char* ICON_VOLUME_UP = "\uf028";
inline const char* ICON_QRCODE = "\uf029";
inline const char* ICON_BARCODE = "\uf02a";
inline const char* ICON_TAG = "\uf02b";
inline const char* ICON_TAGS = "\uf02c";
inline const char* ICON_BOOK = "\uf02d";
inline const char* ICON_BOOKMARK = "\uf02e";
inline const char* ICON_PRINT = "\uf02f";
inline const char* ICON_CAMERA = "\uf030";
inline const char* ICON_FONT = "\uf031";
inline const char* ICON_BOLD = "\uf032";
inline const char* ICON_ITALIC = "\uf033";
inline const char* ICON_TEXT_HEIGHT = "\uf034";
inline const char* ICON_TEXT_WIDTH = "\uf035";
inline const char* ICON_ALIGN_LEFT = "\uf036";
inline const char* ICON_ALIGN_CENTER = "\uf037";
inline const char* ICON_ALIGN_RIGHT = "\uf038";
inline const char* ICON_ALIGN_JUSTIFY = "\uf039";
inline const char* ICON_LIST = "\uf03a";
inline const char* ICON_OUTDENT = "\uf03b";
inline const char* ICON_INDENT = "\uf03c";
inline const char* ICON_VIDEO_CAMERA = "\uf03d";
inline const char* ICON_PICTURE_O = "\uf03e";
inline const char* ICON_PENCIL = "\uf040";
inline const char* ICON_MAP_MARKER = "\uf041";
inline const char* ICON_ADJUST = "\uf042";
inline const char* ICON_TINT = "\uf043";
inline const char* ICON_PENCIL_SQUARE_O = "\uf044";
inline const char* ICON_SHARE_SQUARE_O = "\uf045";
inline const char* ICON_CHECK_SQUARE_O = "\uf046";
inline const char* ICON_ARROWS = "\uf047";
inline const char* ICON_STEP_BACKWARD = "\uf048";
inline const char* ICON_FAST_BACKWARD = "\uf049";
inline const char* ICON_BACKWARD = "\uf04a";
inline const char* ICON_PLAY = "\uf04b";
inline const char* ICON_PAUSE = "\uf04c";
inline const char* ICON_STOP = "\uf04d";
inline const char* ICON_FORWARD = "\uf04e";
inline const char* ICON_FAST_FORWARD = "\uf050";
inline const char* ICON_STEP_FORWARD = "\uf051";
inline const char* ICON_EJECT = "\uf052";
inline const char* ICON_CHEVRON_LEFT = "\uf053";
inline const char* ICON_CHEVRON_RIGHT = "\uf054";
inline const char* ICON_PLUS_CIRCLE = "\uf055";
inline const char* ICON_MINUS_CIRCLE = "\uf056";
inline const char* ICON_TIMES_CIRCLE = "\uf057";
inline const char* ICON_CHECK_CIRCLE = "\uf058";
inline const char* ICON_QUESTION_CIRCLE = "\uf059";
inline const char* ICON_INFO_CIRCLE = "\uf05a";
inline const char* ICON_CROSSHAIRS = "\uf05b";
inline const char* ICON_TIMES_CIRCLE_O = "\uf05c";
inline const char* ICON_CHECK_CIRCLE_O = "\uf05d";
inline const char* ICON_BAN = "\uf05e";
inline const char* ICON_ARROW_LEFT = "\uf060";
inline const char* ICON_ARROW_RIGHT = "\uf061";
inline const char* ICON_ARROW_UP = "\uf062";
inline const char* ICON_ARROW_DOWN = "\uf063";
inline const char* ICON_SHARE = "\uf064";
inline const char* ICON_EXPAND = "\uf065";
inline const char* ICON_COMPRESS = "\uf066";
inline const char* ICON_PLUS = "\uf067";
inline const char* ICON_MINUS = "\uf068";
inline const char* ICON_ASTERISK = "\uf069";
inline const char* ICON_EXCLAMATION_CIRCLE = "\uf06a";
inline const char* ICON_GIFT = "\uf06b";
inline const char* ICON_LEAF = "\uf06c";
inline const char* ICON_FIRE = "\uf06d";
inline const char* ICON_EYE = "\uf06e";
inline const char* ICON_EYE_SLASH = "\uf070";
inline const char* ICON_EXCLAMATION_TRIANGLE = "\uf071";
inline const char* ICON_PLANE = "\uf072";
inline const char* ICON_CALENDAR = "\uf073";
inline const char* ICON_RANDOM = "\uf074";
inline const char* ICON_COMMENT = "\uf075";
inline const char* ICON_MAGNET = "\uf076";
inline const char* ICON_CHEVRON_UP = "\uf077";
inline const char* ICON_CHEVRON_DOWN = "\uf078";
inline const char* ICON_RETWEET = "\uf079";
inline const char* ICON_SHOPPING_CART = "\uf07a";
inline const char* ICON_FOLDER = "\uf07b";
inline const char* ICON_FOLDER_OPEN = "\uf07c";
inline const char* ICON_ARROWS_V = "\uf07d";
inline const char* ICON_ARROWS_H = "\uf07e";
inline const char* ICON_BAR_CHART = "\uf080";
inline const char* ICON_TWITTER_SQUARE = "\uf081";
inline const char* ICON_FACEBOOK_SQUARE = "\uf082";
inline const char* ICON_CAMERA_RETRO = "\uf083";
inline const char* ICON_KEY = "\uf084";
inline const char* ICON_COGS = "\uf085";
inline const char* ICON_COMMENTS = "\uf086";
inline const char* ICON_THUMBS_O_UP = "\uf087";
inline const char* ICON_THUMBS_O_DOWN = "\uf088";
inline const char* ICON_STAR_HALF = "\uf089";
inline const char* ICON_HEART_O = "\uf08a";
inline const char* ICON_SIGN_OUT = "\uf08b";
inline const char* ICON_LINKEDIN_SQUARE = "\uf08c";
inline const char* ICON_THUMB_TACK = "\uf08d";
inline const char* ICON_INLINEAL_LINK = "\uf08e";
inline const char* ICON_SIGN_IN = "\uf090";
inline const char* ICON_TROPHY = "\uf091";
inline const char* ICON_GITHUB_SQUARE = "\uf092";
inline const char* ICON_UPLOAD = "\uf093";
inline const char* ICON_LEMON_O = "\uf094";
inline const char* ICON_PHONE = "\uf095";
inline const char* ICON_SQUARE_O = "\uf096";
inline const char* ICON_BOOKMARK_O = "\uf097";
inline const char* ICON_PHONE_SQUARE = "\uf098";
inline const char* ICON_TWITTER = "\uf099";
inline const char* ICON_FACEBOOK = "\uf09a";
inline const char* ICON_GITHUB = "\uf09b";
inline const char* ICON_UNLOCK = "\uf09c";
inline const char* ICON_CREDIT_CARD = "\uf09d";
inline const char* ICON_RSS = "\uf09e";
inline const char* ICON_HDD_O = "\uf0a0";
inline const char* ICON_BULLHORN = "\uf0a1";
inline const char* ICON_BELL = "\uf0f3";
inline const char* ICON_CERTIFICATE = "\uf0a3";
inline const char* ICON_HAND_O_RIGHT = "\uf0a4";
inline const char* ICON_HAND_O_LEFT = "\uf0a5";
inline const char* ICON_HAND_O_UP = "\uf0a6";
inline const char* ICON_HAND_O_DOWN = "\uf0a7";
inline const char* ICON_ARROW_CIRCLE_LEFT = "\uf0a8";
inline const char* ICON_ARROW_CIRCLE_RIGHT = "\uf0a9";
inline const char* ICON_ARROW_CIRCLE_UP = "\uf0aa";
inline const char* ICON_ARROW_CIRCLE_DOWN = "\uf0ab";
inline const char* ICON_GLOBE = "\uf0ac";
inline const char* ICON_GLOBE_E = "\uf304";
inline const char* ICON_GLOBE_W = "\uf305";
inline const char* ICON_WRENCH = "\uf0ad";
inline const char* ICON_TASKS = "\uf0ae";
inline const char* ICON_FILTER = "\uf0b0";
inline const char* ICON_BRIEFCASE = "\uf0b1";
inline const char* ICON_ARROWS_ALT = "\uf0b2";
inline const char* ICON_USERS = "\uf0c0";
inline const char* ICON_LINK = "\uf0c1";
inline const char* ICON_CLOUD = "\uf0c2";
inline const char* ICON_FLASK = "\uf0c3";
inline const char* ICON_SCISSORS = "\uf0c4";
inline const char* ICON_FILES_O = "\uf0c5";
inline const char* ICON_PAPERCLIP = "\uf0c6";
inline const char* ICON_FLOPPY_O = "\uf0c7";
inline const char* ICON_SQUARE = "\uf0c8";
inline const char* ICON_BARS = "\uf0c9";
inline const char* ICON_LIST_UL = "\uf0ca";
inline const char* ICON_LIST_OL = "\uf0cb";
inline const char* ICON_STRIKETHROUGH = "\uf0cc";
inline const char* ICON_UNDERLINE = "\uf0cd";
inline const char* ICON_TABLE = "\uf0ce";
inline const char* ICON_MAGIC = "\uf0d0";
inline const char* ICON_TRUCK = "\uf0d1";
inline const char* ICON_PINTEREST = "\uf0d2";
inline const char* ICON_PINTEREST_SQUARE = "\uf0d3";
inline const char* ICON_GOOGLE_PLUS_SQUARE = "\uf0d4";
inline const char* ICON_GOOGLE_PLUS = "\uf0d5";
inline const char* ICON_MONEY = "\uf0d6";
inline const char* ICON_CARET_DOWN = "\uf0d7";
inline const char* ICON_CARET_UP = "\uf0d8";
inline const char* ICON_CARET_LEFT = "\uf0d9";
inline const char* ICON_CARET_RIGHT = "\uf0da";
inline const char* ICON_COLUMNS = "\uf0db";
inline const char* ICON_SORT = "\uf0dc";
inline const char* ICON_SORT_DESC = "\uf0dd";
inline const char* ICON_SORT_ASC = "\uf0de";
inline const char* ICON_ENVELOPE = "\uf0e0";
inline const char* ICON_LINKEDIN = "\uf0e1";
inline const char* ICON_UNDO = "\uf0e2";
inline const char* ICON_GAVEL = "\uf0e3";
inline const char* ICON_TACHOMETER = "\uf0e4";
inline const char* ICON_COMMENT_O = "\uf0e5";
inline const char* ICON_COMMENTS_O = "\uf0e6";
inline const char* ICON_BOLT = "\uf0e7";
inline const char* ICON_SITEMAP = "\uf0e8";
inline const char* ICON_UMBRELLA = "\uf0e9";
inline const char* ICON_CLIPBOARD = "\uf0ea";
inline const char* ICON_LIGHTBULB_O = "\uf0eb";
inline const char* ICON_EXCHANGE = "\uf0ec";
inline const char* ICON_CLOUD_DOWNLOAD = "\uf0ed";
inline const char* ICON_CLOUD_UPLOAD = "\uf0ee";
inline const char* ICON_USER_MD = "\uf0f0";
inline const char* ICON_STETHOSCOPE = "\uf0f1";
inline const char* ICON_SUITCASE = "\uf0f2";
inline const char* ICON_BELL_O = "\uf0a2";
inline const char* ICON_COFFEE = "\uf0f4";
inline const char* ICON_CUTLERY = "\uf0f5";
inline const char* ICON_FILE_TEXT_O = "\uf0f6";
inline const char* ICON_BUILDING_O = "\uf0f7";
inline const char* ICON_HOSPITAL_O = "\uf0f8";
inline const char* ICON_AMBULANCE = "\uf0f9";
inline const char* ICON_MEDKIT = "\uf0fa";
inline const char* ICON_FIGHTER_JET = "\uf0fb";
inline const char* ICON_BEER = "\uf0fc";
inline const char* ICON_H_SQUARE = "\uf0fd";
inline const char* ICON_PLUS_SQUARE = "\uf0fe";
inline const char* ICON_ANGLE_DOUBLE_LEFT = "\uf100";
inline const char* ICON_ANGLE_DOUBLE_RIGHT = "\uf101";
inline const char* ICON_ANGLE_DOUBLE_UP = "\uf102";
inline const char* ICON_ANGLE_DOUBLE_DOWN = "\uf103";
inline const char* ICON_ANGLE_LEFT = "\uf104";
inline const char* ICON_ANGLE_RIGHT = "\uf105";
inline const char* ICON_ANGLE_UP = "\uf106";
inline const char* ICON_ANGLE_DOWN = "\uf107";
inline const char* ICON_DESKTOP = "\uf108";
inline const char* ICON_LAPTOP = "\uf109";
inline const char* ICON_TABLET = "\uf10a";
inline const char* ICON_MOBILE = "\uf10b";
inline const char* ICON_CIRCLE_O = "\uf10c";
inline const char* ICON_QUOTE_LEFT = "\uf10d";
inline const char* ICON_QUOTE_RIGHT = "\uf10e";
inline const char* ICON_SPINNER = "\uf110";
inline const char* ICON_CIRCLE = "\uf111";
inline const char* ICON_REPLY = "\uf112";
inline const char* ICON_GITHUB_ALT = "\uf113";
inline const char* ICON_FOLDER_O = "\uf114";
inline const char* ICON_FOLDER_OPEN_O = "\uf115";
inline const char* ICON_SMILE_O = "\uf118";
inline const char* ICON_FROWN_O = "\uf119";
inline const char* ICON_MEH_O = "\uf11a";
inline const char* ICON_GAMEPAD = "\uf11b";
inline const char* ICON_KEYBOARD_O = "\uf11c";
inline const char* ICON_FLAG_O = "\uf11d";
inline const char* ICON_FLAG_CHECKERED = "\uf11e";
inline const char* ICON_TERMINAL = "\uf120";
inline const char* ICON_CODE = "\uf121";
inline const char* ICON_REPLY_ALL = "\uf122";
inline const char* ICON_STAR_HALF_O = "\uf123";
inline const char* ICON_LOCATION_ARROW = "\uf124";
inline const char* ICON_CROP = "\uf125";
inline const char* ICON_CODE_FORK = "\uf126";
inline const char* ICON_CHAIN_BROKEN = "\uf127";
inline const char* ICON_QUESTION = "\uf128";
inline const char* ICON_INFO = "\uf129";
inline const char* ICON_EXCLAMATION = "\uf12a";
inline const char* ICON_SUPERSCRIPT = "\uf12b";
inline const char* ICON_SUBSCRIPT = "\uf12c";
inline const char* ICON_ERASER = "\uf12d";
inline const char* ICON_PUZZLE_PIECE = "\uf12e";
inline const char* ICON_MICROPHONE = "\uf130";
inline const char* ICON_MICROPHONE_SLASH = "\uf131";
inline const char* ICON_SHIELD = "\uf132";
inline const char* ICON_CALENDAR_O = "\uf133";
inline const char* ICON_FIRE_EXTINGUISHER = "\uf134";
inline const char* ICON_ROCKET = "\uf135";
inline const char* ICON_MAXCDN = "\uf136";
inline const char* ICON_CHEVRON_CIRCLE_LEFT = "\uf137";
inline const char* ICON_CHEVRON_CIRCLE_RIGHT = "\uf138";
inline const char* ICON_CHEVRON_CIRCLE_UP = "\uf139";
inline const char* ICON_CHEVRON_CIRCLE_DOWN = "\uf13a";
inline const char* ICON_HTML5 = "\uf13b";
inline const char* ICON_CSS3 = "\uf13c";
inline const char* ICON_ANCHOR = "\uf13d";
inline const char* ICON_UNLOCK_ALT = "\uf13e";
inline const char* ICON_BULLSEYE = "\uf140";
inline const char* ICON_ELLIPSIS_H = "\uf141";
inline const char* ICON_ELLIPSIS_V = "\uf142";
inline const char* ICON_RSS_SQUARE = "\uf143";
inline const char* ICON_PLAY_CIRCLE = "\uf144";
inline const char* ICON_TICKET = "\uf145";
inline const char* ICON_MINUS_SQUARE = "\uf146";
inline const char* ICON_MINUS_SQUARE_O = "\uf147";
inline const char* ICON_LEVEL_UP = "\uf148";
inline const char* ICON_LEVEL_DOWN = "\uf149";
inline const char* ICON_CHECK_SQUARE = "\uf14a";
inline const char* ICON_PENCIL_SQUARE = "\uf14b";
inline const char* ICON_inlineAL_LINK_SQUARE = "\uf14c";
inline const char* ICON_SHARE_SQUARE = "\uf14d";
inline const char* ICON_COMPASS = "\uf14e";
inline const char* ICON_CARET_SQUARE_O_DOWN = "\uf150";
inline const char* ICON_CARET_SQUARE_O_UP = "\uf151";
inline const char* ICON_CARET_SQUARE_O_RIGHT = "\uf152";
inline const char* ICON_EUR = "\uf153";
inline const char* ICON_GBP = "\uf154";
inline const char* ICON_USD = "\uf155";
inline const char* ICON_INR = "\uf156";
inline const char* ICON_JPY = "\uf157";
inline const char* ICON_RUB = "\uf158";
inline const char* ICON_KRW = "\uf159";
inline const char* ICON_BTC = "\uf15a";
inline const char* ICON_FILE = "\uf15b";
inline const char* ICON_FILE_TEXT = "\uf15c";
inline const char* ICON_SORT_ALPHA_ASC = "\uf15d";
inline const char* ICON_SORT_ALPHA_DESC = "\uf15e";
inline const char* ICON_SORT_AMOUNT_ASC = "\uf160";
inline const char* ICON_SORT_AMOUNT_DESC = "\uf161";
inline const char* ICON_SORT_NUMERIC_ASC = "\uf162";
inline const char* ICON_SORT_NUMERIC_DESC = "\uf163";
inline const char* ICON_THUMBS_UP = "\uf164";
inline const char* ICON_THUMBS_DOWN = "\uf165";
inline const char* ICON_YOUTUBE_SQUARE = "\uf166";
inline const char* ICON_YOUTUBE = "\uf167";
inline const char* ICON_XING = "\uf168";
inline const char* ICON_XING_SQUARE = "\uf169";
inline const char* ICON_YOUTUBE_PLAY = "\uf16a";
inline const char* ICON_DROPBOX = "\uf16b";
inline const char* ICON_STACK_OVERFLOW = "\uf16c";
inline const char* ICON_INSTAGRAM = "\uf16d";
inline const char* ICON_FLICKR = "\uf16e";
inline const char* ICON_ADN = "\uf170";
inline const char* ICON_BITBUCKET = "\uf171";
inline const char* ICON_BITBUCKET_SQUARE = "\uf172";
inline const char* ICON_TUMBLR = "\uf173";
inline const char* ICON_TUMBLR_SQUARE = "\uf174";
inline const char* ICON_LONG_ARROW_DOWN = "\uf175";
inline const char* ICON_LONG_ARROW_UP = "\uf176";
inline const char* ICON_LONG_ARROW_LEFT = "\uf177";
inline const char* ICON_LONG_ARROW_RIGHT = "\uf178";
inline const char* ICON_APPLE = "\uf179";
inline const char* ICON_PROJECTS = "\uf17a";
inline const char* ICON_ANDROID = "\uf17b";
inline const char* ICON_LINUX = "\uf17c";
inline const char* ICON_DRIBBBLE = "\uf17d";
inline const char* ICON_SKYPE = "\uf17e";
inline const char* ICON_FOURSQUARE = "\uf180";
inline const char* ICON_TRELLO = "\uf181";
inline const char* ICON_FEMALE = "\uf182";
inline const char* ICON_MALE = "\uf183";
inline const char* ICON_GRATIPAY = "\uf184";
inline const char* ICON_SUN_O = "\uf185";
inline const char* ICON_MOON_O = "\uf186";
inline const char* ICON_ARCHIVE = "\uf187";
inline const char* ICON_BUG = "\uf188";
inline const char* ICON_VK = "\uf189";
inline const char* ICON_WEIBO = "\uf18a";
inline const char* ICON_RENREN = "\uf18b";
inline const char* ICON_PAGELINES = "\uf18c";
inline const char* ICON_STACK_EXCHANGE = "\uf18d";
inline const char* ICON_ARROW_CIRCLE_O_RIGHT = "\uf18e";
inline const char* ICON_ARROW_CIRCLE_O_LEFT = "\uf190";
inline const char* ICON_CARET_SQUARE_O_LEFT = "\uf191";
inline const char* ICON_DOT_CIRCLE_O = "\uf192";
inline const char* ICON_WHEELCHAIR = "\uf193";
inline const char* ICON_VIMEO_SQUARE = "\uf194";
inline const char* ICON_TRY = "\uf195";
inline const char* ICON_PLUS_SQUARE_O = "\uf196";
inline const char* ICON_SPACE_SHUTTLE = "\uf197";
inline const char* ICON_SLACK = "\uf198";
inline const char* ICON_ENVELOPE_SQUARE = "\uf199";
inline const char* ICON_WORDPRESS = "\uf19a";
inline const char* ICON_OPENID = "\uf19b";
inline const char* ICON_UNIVERSITY = "\uf19c";
inline const char* ICON_GRADUATION_CAP = "\uf19d";
inline const char* ICON_YAHOO = "\uf19e";
inline const char* ICON_GOOGLE = "\uf1a0";
inline const char* ICON_REDDIT = "\uf1a1";
inline const char* ICON_REDDIT_SQUARE = "\uf1a2";
inline const char* ICON_STUMBLEUPON_CIRCLE = "\uf1a3";
inline const char* ICON_STUMBLEUPON = "\uf1a4";
inline const char* ICON_DELICIOUS = "\uf1a5";
inline const char* ICON_DIGG = "\uf1a6";
inline const char* ICON_DRUPAL = "\uf1a9";
inline const char* ICON_JOOMLA = "\uf1aa";
inline const char* ICON_LANGUAGE = "\uf1ab";
inline const char* ICON_FAX = "\uf1ac";
inline const char* ICON_BUILDING = "\uf1ad";
inline const char* ICON_CHILD = "\uf1ae";
inline const char* ICON_PAW = "\uf1b0";
inline const char* ICON_SPOON = "\uf1b1";
inline const char* ICON_CUBE = "\uf1b2";
inline const char* ICON_CUBES = "\uf1b3";
inline const char* ICON_BEHANCE = "\uf1b4";
inline const char* ICON_BEHANCE_SQUARE = "\uf1b5";
inline const char* ICON_STEAM = "\uf1b6";
inline const char* ICON_STEAM_SQUARE = "\uf1b7";
inline const char* ICON_RECYCLE = "\uf1b8";
inline const char* ICON_CAR = "\uf1b9";
inline const char* ICON_TAXI = "\uf1ba";
inline const char* ICON_TREE = "\uf1bb";
inline const char* ICON_SPOTIFY = "\uf1bc";
inline const char* ICON_DEVIANTART = "\uf1bd";
inline const char* ICON_SOUNDCLOUD = "\uf1be";
inline const char* ICON_DATABASE = "\uf1c0";
inline const char* ICON_FILE_PDF_O = "\uf1c1";
inline const char* ICON_FILE_WORD_O = "\uf1c2";
inline const char* ICON_FILE_EXCEL_O = "\uf1c3";
inline const char* ICON_FILE_POWERPOINT_O = "\uf1c4";
inline const char* ICON_SAVE = "\uf0c7";
inline const char* ICON_FILE_IMAGE_O = "\uf1c5";
inline const char* ICON_FILE_ARCHIVE_O = "\uf1c6";
inline const char* ICON_FILE_AUDIO_O = "\uf1c7";
inline const char* ICON_FILE_VIDEO_O = "\uf1c8";
inline const char* ICON_FILE_CODE_O = "\uf1c9";
inline const char* ICON_VINE = "\uf1ca";
inline const char* ICON_CODEPEN = "\uf1cb";
inline const char* ICON_JSFIDDLE = "\uf1cc";
inline const char* ICON_LIFE_RING = "\uf1cd";
inline const char* ICON_CIRCLE_O_NOTCH = "\uf1ce";
inline const char* ICON_REBEL = "\uf1d0";
inline const char* ICON_EMPIRE = "\uf1d1";
inline const char* ICON_GIT_SQUARE = "\uf1d2";
inline const char* ICON_GIT = "\uf1d3";
inline const char* ICON_HACKER_NEWS = "\uf1d4";
inline const char* ICON_TENCENT_WEIBO = "\uf1d5";
inline const char* ICON_QQ = "\uf1d6";
inline const char* ICON_WEIXIN = "\uf1d7";
inline const char* ICON_PAPER_PLANE = "\uf1d8";
inline const char* ICON_PAPER_PLANE_O = "\uf1d9";
inline const char* ICON_HISTORY = "\uf1da";
inline const char* ICON_CIRCLE_THIN = "\uf1db";
inline const char* ICON_HEADER = "\uf1dc";
inline const char* ICON_PARAGRAPH = "\uf1dd";
inline const char* ICON_SLIDERS = "\uf1de";
inline const char* ICON_SHARE_ALT = "\uf1e0";
inline const char* ICON_SHARE_ALT_SQUARE = "\uf1e1";
inline const char* ICON_BOMB = "\uf1e2";
inline const char* ICON_FUTBOL_O = "\uf1e3";
inline const char* ICON_TTY = "\uf1e4";
inline const char* ICON_BINOCULARS = "\uf1e5";
inline const char* ICON_PLUG = "\uf1e6";
inline const char* ICON_SLIDESHARE = "\uf1e7";
inline const char* ICON_TWITCH = "\uf1e8";
inline const char* ICON_YELP = "\uf1e9";
inline const char* ICON_NEWSPAPER_O = "\uf1ea";
inline const char* ICON_WIFI = "\uf1eb";
inline const char* ICON_CALCULATOR = "\uf1ec";
inline const char* ICON_PAYPAL = "\uf1ed";
inline const char* ICON_GOOGLE_WALLET = "\uf1ee";
inline const char* ICON_CC_VISA = "\uf1f0";
inline const char* ICON_CC_MASTERCARD = "\uf1f1";
inline const char* ICON_CC_DISCOVER = "\uf1f2";
inline const char* ICON_CC_AMEX = "\uf1f3";
inline const char* ICON_CC_PAYPAL = "\uf1f4";
inline const char* ICON_CC_STRIPE = "\uf1f5";
inline const char* ICON_BELL_SLASH = "\uf1f6";
inline const char* ICON_BELL_SLASH_O = "\uf1f7";
inline const char* ICON_TRASH = "\uf1f8";
inline const char* ICON_COPYRIGHT = "\uf1f9";
inline const char* ICON_AT = "\uf1fa";
inline const char* ICON_EYEDROPPER = "\uf1fb";
inline const char* ICON_PAINT_BRUSH = "\uf1fc";
inline const char* ICON_BIRTHDAY_CAKE = "\uf1fd";
inline const char* ICON_AREA_CHART = "\uf1fe";
inline const char* ICON_PIE_CHART = "\uf200";
inline const char* ICON_LINE_CHART = "\uf201";
inline const char* ICON_LASTFM = "\uf202";
inline const char* ICON_LASTFM_SQUARE = "\uf203";
inline const char* ICON_TOGGLE_OFF = "\uf204";
inline const char* ICON_TOGGLE_ON = "\uf205";
inline const char* ICON_BICYCLE = "\uf206";
inline const char* ICON_BUS = "\uf207";
inline const char* ICON_IOXHOST = "\uf208";
inline const char* ICON_ANGELLIST = "\uf209";
inline const char* ICON_CC = "\uf20a";
inline const char* ICON_ILS = "\uf20b";
inline const char* ICON_MEANPATH = "\uf20c";
inline const char* ICON_BUYSELLADS = "\uf20d";
inline const char* ICON_CONNECTDEVELOP = "\uf20e";
inline const char* ICON_DASHCUBE = "\uf210";
inline const char* ICON_FORUMBEE = "\uf211";
inline const char* ICON_LEANPUB = "\uf212";
inline const char* ICON_SELLSY = "\uf213";
inline const char* ICON_SHIRTSINBULK = "\uf214";
inline const char* ICON_SIMPLYBUILT = "\uf215";
inline const char* ICON_SKYATLAS = "\uf216";
inline const char* ICON_CART_PLUS = "\uf217";
inline const char* ICON_CART_ARROW_DOWN = "\uf218";
inline const char* ICON_DIAMOND = "\uf219";
inline const char* ICON_SHIP = "\uf21a";
inline const char* ICON_USER_SECRET = "\uf21b";
inline const char* ICON_MOTORCYCLE = "\uf21c";
inline const char* ICON_STREET_VIEW = "\uf21d";
inline const char* ICON_HEARTBEAT = "\uf21e";
inline const char* ICON_VENUS = "\uf221";
inline const char* ICON_MARS = "\uf222";
inline const char* ICON_MERCURY = "\uf223";
inline const char* ICON_TRANSGENDER = "\uf224";
inline const char* ICON_TRANSGENDER_ALT = "\uf225";
inline const char* ICON_VENUS_DOUBLE = "\uf226";
inline const char* ICON_MARS_DOUBLE = "\uf227";
inline const char* ICON_VENUS_MARS = "\uf228";
inline const char* ICON_MARS_STROKE = "\uf229";
inline const char* ICON_MARS_STROKE_V = "\uf22a";
inline const char* ICON_MARS_STROKE_H = "\uf22b";
inline const char* ICON_NEUTER = "\uf22c";
inline const char* ICON_GENDERLESS = "\uf22d";
inline const char* ICON_FACEBOOK_OFFICIAL = "\uf230";
inline const char* ICON_PINTEREST_P = "\uf231";
inline const char* ICON_WHATSAPP = "\uf232";
inline const char* ICON_SERVER = "\uf233";
inline const char* ICON_USER_PLUS = "\uf234";
inline const char* ICON_USER_TIMES = "\uf235";
inline const char* ICON_BED = "\uf236";
inline const char* ICON_VIACOIN = "\uf237";
inline const char* ICON_TRAIN = "\uf238";
inline const char* ICON_SUBWAY = "\uf239";
inline const char* ICON_MEDIUM = "\uf23a";
inline const char* ICON_MEDIUM_SQUARE = "\uf2f8";
inline const char* ICON_Y_COMBINATOR = "\uf23b";
inline const char* ICON_OPTIN_MONSTER = "\uf23c";
inline const char* ICON_OPENCART = "\uf23d";
inline const char* ICON_EXPEDITEDSSL = "\uf23e";
inline const char* ICON_BATTERY_FULL = "\uf240";
inline const char* ICON_BATTERY_THREE_QUARTERS = "\uf241";
inline const char* ICON_BATTERY_HALF = "\uf242";
inline const char* ICON_BATTERY_QUARTER = "\uf243";
inline const char* ICON_BATTERY_EMPTY = "\uf244";
inline const char* ICON_MOUSE_POINTER = "\uf245";
inline const char* ICON_I_CURSOR = "\uf246";
inline const char* ICON_OBJECT_GROUP = "\uf247";
inline const char* ICON_OBJECT_UNGROUP = "\uf248";
inline const char* ICON_STICKY_NOTE = "\uf249";
inline const char* ICON_STICKY_NOTE_O = "\uf24a";
inline const char* ICON_CC_JCB = "\uf24b";
inline const char* ICON_CC_DINERS_CLUB = "\uf24c";
inline const char* ICON_CLONE = "\uf24d";
inline const char* ICON_BALANCE_SCALE = "\uf24e";
inline const char* ICON_HOURGLASS_O = "\uf250";
inline const char* ICON_HOURGLASS_START = "\uf251";
inline const char* ICON_HOURGLASS_HALF = "\uf252";
inline const char* ICON_HOURGLASS_END = "\uf253";
inline const char* ICON_HOURGLASS = "\uf254";
inline const char* ICON_HAND_ROCK_O = "\uf255";
inline const char* ICON_HAND_PAPER_O = "\uf256";
inline const char* ICON_HAND_SCISSORS_O = "\uf257";
inline const char* ICON_HAND_LIZARD_O = "\uf258";
inline const char* ICON_HAND_SPOCK_O = "\uf259";
inline const char* ICON_HAND_POINTER_O = "\uf25a";
inline const char* ICON_HAND_PEACE_O = "\uf25b";
inline const char* ICON_TRADEMARK = "\uf25c";
inline const char* ICON_REGISTERED = "\uf25d";
inline const char* ICON_CREATIVE_COMMONS = "\uf25e";
inline const char* ICON_GG = "\uf260";
inline const char* ICON_GG_CIRCLE = "\uf261";
inline const char* ICON_TRIPADVISOR = "\uf262";
inline const char* ICON_ODNOKLASSNIKI = "\uf263";
inline const char* ICON_ODNOKLASSNIKI_SQUARE = "\uf264";
inline const char* ICON_GET_POCKET = "\uf265";
inline const char* ICON_WIKIPEDIA_W = "\uf266";
inline const char* ICON_SAFARI = "\uf267";
inline const char* ICON_CHROME = "\uf268";
inline const char* ICON_FIREFOX = "\uf269";
inline const char* ICON_OPERA = "\uf26a";
inline const char* ICON_INTERNET_EXPLORER = "\uf26b";
inline const char* ICON_TELEVISION = "\uf26c";
inline const char* ICON_CONTAO = "\uf26d";
inline const char* ICON_500PX = "\uf26e";
inline const char* ICON_AMAZON = "\uf270";
inline const char* ICON_CALENDAR_PLUS_O = "\uf271";
inline const char* ICON_CALENDAR_MINUS_O = "\uf272";
inline const char* ICON_CALENDAR_TIMES_O = "\uf273";
inline const char* ICON_CALENDAR_CHECK_O = "\uf274";
inline const char* ICON_INDUSTRY = "\uf275";
inline const char* ICON_MAP_PIN = "\uf276";
inline const char* ICON_MAP_SIGNS = "\uf277";
inline const char* ICON_MAP_O = "\uf278";
inline const char* ICON_MAP = "\uf279";
inline const char* ICON_COMMENTING = "\uf27a";
inline const char* ICON_COMMENTING_O = "\uf27b";
inline const char* ICON_HOUZZ = "\uf27c";
inline const char* ICON_VIMEO = "\uf27d";
inline const char* ICON_BLACK_TIE = "\uf27e";
inline const char* ICON_FONTICONS = "\uf280";
inline const char* ICON_REDDIT_ALIEN = "\uf281";
inline const char* ICON_EDGE = "\uf282";
inline const char* ICON_CREDIT_CARD_ALT = "\uf283";
inline const char* ICON_CODIEPIE = "\uf284";
inline const char* ICON_MODX = "\uf285";
inline const char* ICON_FORT_AWESOME = "\uf286";
inline const char* ICON_USB = "\uf287";
inline const char* ICON_PRODUCT_HUNT = "\uf288";
inline const char* ICON_MIXCLOUD = "\uf289";
inline const char* ICON_SCRIBD = "\uf28a";
inline const char* ICON_PAUSE_CIRCLE = "\uf28b";
inline const char* ICON_PAUSE_CIRCLE_O = "\uf28c";
inline const char* ICON_STOP_CIRCLE = "\uf28d";
inline const char* ICON_STOP_CIRCLE_O = "\uf28e";
inline const char* ICON_SHOPPING_BAG = "\uf290";
inline const char* ICON_SHOPPING_BASKET = "\uf291";
inline const char* ICON_HASHTAG = "\uf292";
inline const char* ICON_BLUETOOTH = "\uf293";
inline const char* ICON_BLUETOOTH_B = "\uf294";
inline const char* ICON_PERCENT = "\uf295";
inline const char* ICON_GITLAB = "\uf296";
inline const char* ICON_WPBEGINNER = "\uf297";
inline const char* ICON_WPFORMS = "\uf298";
inline const char* ICON_ENVIRA = "\uf299";
inline const char* ICON_UNIVERSAL_ACCESS = "\uf29a";
inline const char* ICON_WHEELCHAIR_ALT = "\uf29b";
inline const char* ICON_QUESTION_CIRCLE_O = "\uf29c";
inline const char* ICON_BLIND = "\uf29d";
inline const char* ICON_AUDIO_DESCRIPTION = "\uf29e";
inline const char* ICON_VOLUME_CONTROL_PHONE = "\uf2a0";
inline const char* ICON_BRAILLE = "\uf2a1";
inline const char* ICON_ASSISTIVE_LISTENING_SYSTEMS = "\uf2a2";
inline const char* ICON_AMERICAN_SIGN_LANGUAGE_INTERPRETING = "\uf2a3";
inline const char* ICON_DEAF = "\uf2a4";
inline const char* ICON_GLIDE = "\uf2a5";
inline const char* ICON_GLIDE_G = "\uf2a6";
inline const char* ICON_SIGN_LANGUAGE = "\uf2a7";
inline const char* ICON_LOW_VISION = "\uf2a8";
inline const char* ICON_VIADEO = "\uf2a9";
inline const char* ICON_VIADEO_SQUARE = "\uf2aa";
inline const char* ICON_SNAPCHAT = "\uf2ab";
inline const char* ICON_SNAPCHAT_GHOST = "\uf2ac";
inline const char* ICON_SNAPCHAT_SQUARE = "\uf2ad";
inline const char* ICON_FIRST_ORDER = "\uf2b0";
inline const char* ICON_YOAST = "\uf2b1";
inline const char* ICON_THEMEISLE = "\uf2b2";
inline const char* ICON_GOOGLE_PLUS_OFFICIAL = "\uf2b3";
inline const char* ICON_FONT_AWESOME = "\uf2b4";
inline const char* ICON_HANDSHAKE_O = "\uf2b5";
inline const char* ICON_ENVELOPE_OPEN = "\uf2b6";
inline const char* ICON_ENVELOPE_OPEN_O = "\uf2b7";
inline const char* ICON_LINODE = "\uf2b8";
inline const char* ICON_ADDRESS_BOOK = "\uf2b9";
inline const char* ICON_ADDRESS_BOOK_O = "\uf2ba";
inline const char* ICON_ADDRESS_CARD = "\uf2bb";
inline const char* ICON_ADDRESS_CARD_O = "\uf2bc";
inline const char* ICON_USER_CIRCLE = "\uf2bd";
inline const char* ICON_USER_CIRCLE_O = "\uf2be";
inline const char* ICON_USER_O = "\uf2c0";
inline const char* ICON_ID_BADGE = "\uf2c1";
inline const char* ICON_ID_CARD = "\uf2c2";
inline const char* ICON_ID_CARD_O = "\uf2c3";
inline const char* ICON_QUORA = "\uf2c4";
inline const char* ICON_FREE_CODE_CAMP = "\uf2c5";
inline const char* ICON_TELEGRAM = "\uf2c6";
inline const char* ICON_THERMOMETER_FULL = "\uf2c7";
inline const char* ICON_THERMOMETER_THREE_QUARTERS = "\uf2c8";
inline const char* ICON_THERMOMETER_HALF = "\uf2c9";
inline const char* ICON_THERMOMETER_QUARTER = "\uf2ca";
inline const char* ICON_THERMOMETER_EMPTY = "\uf2cb";
inline const char* ICON_SHOWER = "\uf2cc";
inline const char* ICON_BATH = "\uf2cd";
inline const char* ICON_PODCAST = "\uf2ce";
inline const char* ICON_WINDOW_MAXIMIZE = "\uf2d0";
inline const char* ICON_WINDOW_MINIMIZE = "\uf2d1";
inline const char* ICON_WINDOW_RESTORE = "\uf2d2";
inline const char* ICON_WINDOW_CLOSE = "\uf2d3";
inline const char* ICON_WINDOW_CLOSE_O = "\uf2d4";
inline const char* ICON_BANDCAMP = "\uf2d5";
inline const char* ICON_GRAV = "\uf2d6";
inline const char* ICON_ETSY = "\uf2d7";
inline const char* ICON_IMDB = "\uf2d8";
inline const char* ICON_RAVELRY = "\uf2d9";
inline const char* ICON_EERCAST = "\uf2da";
inline const char* ICON_MICROCHIP = "\uf2db";
inline const char* ICON_SNOWFLAKE_O = "\uf2dc";
inline const char* ICON_SUPERPOWERS = "\uf2dd";
inline const char* ICON_WPEXPLORER = "\uf2de";
inline const char* ICON_MEETUP = "\uf2e0";
inline const char* ICON_MASTODON = "\uf2e1";
inline const char* ICON_MASTODON_ALT = "\uf2e2";
inline const char* ICON_FORK_AWESOME = "\uf2e3";
inline const char* ICON_PEERTUBE = "\uf2e4";
inline const char* ICON_DIASPORA = "\uf2e5";
inline const char* ICON_FRIENDICA = "\uf2e6";
inline const char* ICON_GNU_SOCIAL = "\uf2e7";
inline const char* ICON_LIBERAPAY_SQUARE = "\uf2e8";
inline const char* ICON_LIBERAPAY = "\uf2e9";
inline const char* ICON_SCUTTLEBUTT = "\uf2ea";
inline const char* ICON_HUBZILLA = "\uf2eb";
inline const char* ICON_SOCIAL_HOME = "\uf2ec";
inline const char* ICON_ARTSTATION = "\uf2ed";
inline const char* ICON_DISCORD = "\uf2ee";
inline const char* ICON_DISCORD_ALT = "\uf2ef";
inline const char* ICON_PATREON = "\uf2f0";
inline const char* ICON_SNOWDRIFT = "\uf2f1";
inline const char* ICON_ACTIVITYPUB = "\uf2f2";
inline const char* ICON_ETHEREUM = "\uf2f3";
inline const char* ICON_KEYBASE = "\uf2f4";
inline const char* ICON_SHAARLI = "\uf2f5";
inline const char* ICON_SHAARLI_O = "\uf2f6";
inline const char* ICON_KEY_MODERN = "\uf2f7";
inline const char* ICON_XMPP = "\uf2f9";
inline const char* ICON_ARCHIVE_ORG = "\uf2fc";
inline const char* ICON_FREEDOMBOX = "\uf2fd";
inline const char* ICON_FACEBOOK_MESSENGER = "\uf2fe";
inline const char* ICON_DEBIAN = "\uf2ff";
inline const char* ICON_MASTODON_SQUARE = "\uf300";
inline const char* ICON_TIPEEE = "\uf301";
inline const char* ICON_REACT = "\uf302";
inline const char* ICON_DOGMAZIC = "\uf303";
inline const char* ICON_NEXTCLOUD = "\uf306";
inline const char* ICON_NEXTCLOUD_SQUARE = "\uf307";
} // namespace Icon

View File

@ -0,0 +1,82 @@
#pragma once
#include "imgui.h"
#include "icons.hpp"
#include "fonts.hpp"
namespace try_engine::style
{
inline void init()
{
/* use this - https://www.unknowncheats.me/forum/c-and-c-/189635-imgui-style-settings.html */
ImGuiStyle& st = ImGui::GetStyle();
st.WindowPadding = ImVec2(5.0f, 5.0f);
st.WindowRounding = 0.0f;
st.FramePadding = ImVec2(5.0f, 5.0f);
st.FrameRounding = 0.0f;
st.ItemSpacing = ImVec2(8.0f, 8.0f);
st.ItemInnerSpacing = ImVec2(8.0f, 6.0f);
st.IndentSpacing = 25.0f;
st.ScrollbarSize = 12.0f;
st.ScrollbarRounding = 0.0f;
st.GrabMinSize = 5.0f;
st.GrabRounding = 0.0f;
st.TabRounding = 0.0f;
st.WindowBorderSize = 0.0f;
st.ChildRounding = 0.0f;
st.PopupRounding = 0.0f;
st.PopupBorderSize = 0.0f;
st.WindowMenuButtonPosition = ImGuiDir_None;
/* tab */
st.Colors[ImGuiCol_Tab] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_TabActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
/* title */
st.Colors[ImGuiCol_TitleBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TitleBgCollapsed] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_TitleBgActive] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
st.Colors[ImGuiCol_Text] = ImVec4(0.80f, 0.80f, 0.83f, 1.00f);
st.Colors[ImGuiCol_TextDisabled] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_WindowBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_ChildBg] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_PopupBg] = ImVec4(0.07f, 0.07f, 0.09f, 1.00f);
st.Colors[ImGuiCol_Border] = ImVec4(0.80f, 0.80f, 0.83f, 0.88f);
st.Colors[ImGuiCol_BorderShadow] = ImVec4(0.92f, 0.91f, 0.88f, 0.00f);
st.Colors[ImGuiCol_FrameBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_FrameBgHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_FrameBgActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_MenuBarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_ScrollbarBg] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_ScrollbarGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_ScrollbarGrabHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ScrollbarGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_CheckMark] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_SliderGrab] = ImVec4(0.80f, 0.80f, 0.83f, 0.31f);
st.Colors[ImGuiCol_SliderGrabActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_Button] = ImVec4(0.10f, 0.09f, 0.12f, 1.00f);
st.Colors[ImGuiCol_ButtonHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ButtonActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_Header] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_HeaderActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_Separator] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_SeparatorHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_SeparatorActive] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ResizeGrip] = ImVec4(0.00f, 0.00f, 0.00f, 0.00f);
st.Colors[ImGuiCol_ResizeGripHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
st.Colors[ImGuiCol_ResizeGripActive] = ImVec4(0.06f, 0.05f, 0.07f, 1.00f);
st.Colors[ImGuiCol_PlotLines] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
st.Colors[ImGuiCol_PlotLinesHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
st.Colors[ImGuiCol_PlotHistogram] = ImVec4(0.40f, 0.39f, 0.38f, 0.63f);
st.Colors[ImGuiCol_PlotHistogramHovered] = ImVec4(0.25f, 1.00f, 0.00f, 1.00f);
st.Colors[ImGuiCol_TextSelectedBg] = ImVec4(0.25f, 1.00f, 0.00f, 0.43f);
st.Colors[ImGuiCol_ModalWindowDimBg] = ImVec4(1.00f, 0.98f, 0.95f, 0.73f);
st.Colors[ImGuiCol_HeaderHovered] = ImVec4(0.13f, 0.12f, 0.15f, 1.00f);
fonts::init();
};
};

View File

@ -0,0 +1,27 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "try_engine/event/system_event/event.hpp"
namespace try_engine
{
class layer
{
using time = time::timestep<float>;
public:
layer() = default;
virtual ~layer() = default;
layer(const layer&) = delete;
layer(layer&) = delete;
public:
virtual void on_attach() {};
virtual void on_detach() {};
virtual void gui_render() {};
virtual void on_event(system_event::event&) {};
virtual void on_event(std::any, std::any) {};
};
}

View File

@ -0,0 +1,32 @@
headers = [
'application/application.hpp',
'window/window.hpp',
'window/graphic_context/graphic_context.hpp',
'renderer/renderer.hpp',
'renderer/texture/texture.hpp',
'gui/gui.hpp',
]
sources = [
'application/application.cpp',
'window/window.cpp',
'window/graphic_context/graphic_context.cpp',
'renderer/renderer.cpp',
'renderer/texture/texture.cpp',
'gui/gui.cpp',
]
lib = library(
'try_engine',
include_directories : inc,
sources: [headers, sources],
dependencies : deps,
cpp_args: args
)
try_engine_dep = declare_dependency(
include_directories: inc,
link_with: lib,
)
deps += try_engine_dep

View File

@ -0,0 +1,14 @@
#include "renderer.hpp"
namespace try_engine
{
void renderer::set_color(const glm::vec4& color)
{
glClearColor(color.r, color.g, color.b, color.a);
}
void renderer::clear()
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
}

View File

@ -0,0 +1,22 @@
#pragma once
#include "try_engine/utils/utils.hpp"
/*
renderer - некий объект отрисовки и разукраски всей сцены.
Т.е. в нем все компоненты, которые нужны для создания на сцене чего-либо:
шейдера, шейдерные программы, буфера вершин, вспомогательные функции установки цвета и его очистки и т.п.
Может использоваться в разных частях программы, где нужно что-то создать и отрисовать или перекрасить и удалить.
Относимся к этому, как к набору кисточек и ластиков при помощи которых что-то делаем на экране, рисуем или стираем.
*/
namespace try_engine
{
class renderer
{
public:
static void set_color(const glm::vec4&);
static void clear();
};
}

View File

@ -0,0 +1,32 @@
#include "texture.hpp"
namespace try_engine
{
texture::~texture()
{
glDeleteTextures(1, &m_texture_id);
}
void texture::make()
{
if (!m_texture_id)
{
glGenTextures(1, &m_texture_id);
glBindTexture(GL_TEXTURE_2D, m_texture_id);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
}
}
void texture::clear()
{
glDeleteTextures(1, &m_texture_id);
}
void texture::draw(ImVec2 pos, ImVec2 size)
{
// ImGui::Image(reinterpret_cast<void*>(static_cast<intptr_t>(texture)), ImVec2(pos.x + 100, pos.y + 100));
ImGui::GetWindowDrawList()->AddImage(reinterpret_cast<void*>(static_cast<intptr_t>(m_texture_id)), pos, size);
}
}

View File

@ -0,0 +1,31 @@
#pragma once
#include "try_engine/utils/utils.hpp"
namespace try_engine
{
class texture
{
public:
texture() = default;
~texture();
private:
GLuint m_texture_id = 0;
public:
template<typename Image>
void bind(Image& image)
{
// HERE наяинаем тут
// возможно эту штуку нужно делать сразу полсе make
// либо перенеси ее в make
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.cols, image.rows, 0, GL_RGBA, GL_UNSIGNED_BYTE, image.data);
}
void draw(ImVec2 pos, ImVec2 size);
void make();
void clear();
};
}

View File

@ -0,0 +1,17 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "try_engine/gui/gui.hpp"
#include "try_engine/gui/style/style.hpp"
#include "try_engine/application/application.hpp"
#include "try_engine/event/system_event/classificator.hpp"
#include "try_engine/event/system_event/event.hpp"
#include "try_engine/event/system_event/category/key_event.hpp"
#include "try_engine/event/system_event/category/window_event.hpp"
#include "try_engine/event/app_event/event.hpp"
#include "try_engine/renderer/renderer.hpp"
#include "try_engine/renderer/texture/texture.hpp"

View File

@ -0,0 +1,85 @@
#pragma once
#define BIT(x)\
(1 << x)
#define EVENT_CLASS_TYPE_FN(type)\
virtual std::string get_name() const override { return type; }
#define BIND_EVENT_FN(app, x)\
std::bind(&app::x, this, std::placeholders::_1)
#define BASE_TYPE_DEFINE()\
using time = try_engine::time::timestep<float>;\
using event_manager = try_engine::app_event::event;\
using system_event = try_engine::system_event::event;\
using win = try_engine::win
#define BASE_WINDOW_FLAGS()\
if (m_flags.m_no_titlebar) m_window_flags |= ImGuiWindowFlags_NoTitleBar;\
if (m_flags.m_no_scrollbar) m_window_flags |= ImGuiWindowFlags_NoScrollbar;\
if (!m_flags.m_no_menu) m_window_flags |= ImGuiWindowFlags_MenuBar;\
if (m_flags.m_no_move) m_window_flags |= ImGuiWindowFlags_NoMove;\
if (m_flags.m_no_resize) m_window_flags |= ImGuiWindowFlags_NoResize;\
if (m_flags.m_no_collapse) m_window_flags |= ImGuiWindowFlags_NoCollapse;\
if (m_flags.m_no_nav) m_window_flags |= ImGuiWindowFlags_NoNav;\
if (m_flags.m_no_background) m_window_flags |= ImGuiWindowFlags_NoBackground;\
if (m_flags.m_no_bring_to_front) m_window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus
#define SET_EVENT_MANAGER_IMPL()\
void set_event_manager(event_manager* in_event_manager)\
{\
m_event_manager = in_event_manager;\
m_event_manager->set_event_callback(this);\
}
#define BASE_OVERIDE_IMPL()\
void on_attach() override;\
void on_detach() override;\
void gui_render() override;\
void on_event(system_event& e) override;\
void on_event(std::any type, std::any value) override
#define CONSTRUCT_IMPL(name)\
name() : try_engine::layer() { BASE_WINDOW_FLAGS(); };\
~name() = default
#define FLAGS_STRUCT_DEFINED()\
struct flags\
{\
bool m_p_open = false;\
bool m_no_titlebar = true;\
bool m_no_scrollbar = true;\
bool m_no_menu = true;\
bool m_no_move = true;\
bool m_no_resize = true;\
bool m_no_collapse = true;\
bool m_no_nav = false;\
bool m_no_background = false;\
bool m_no_bring_to_front = false;\
bool m_no_docking = true;\
} m_flags;\
ImGuiWindowFlags m_window_flags = 0
#define BASE_IMPL(name)\
BASE_TYPE_DEFINE();\
public:\
CONSTRUCT_IMPL(name);\
public:\
BASE_OVERIDE_IMPL();\
public:\
SET_EVENT_MANAGER_IMPL();\
private:\
FLAGS_STRUCT_DEFINED();\
private:\
event_manager* m_event_manager;\
win m_win
#define BEGIN_IMGUI_WIN() if (!ImGui::Begin(m_win.m_name.c_str(), &m_flags.m_p_open, m_window_flags)) ImGui::End()
#define END_IMGUI_WIN() ImGui::End()
#define TR_PUSH_FONT(def_font, def_size)\
ImGui::PushFont(try_engine::style::fonts::get_font(try_engine::style::fonts::font_type::def_font, def_size))
#define TR_POP_FONT() ImGui::PopFont()

View File

@ -0,0 +1,20 @@
#pragma once
#include <opencv2/opencv.hpp>
#include <functional>
#include <memory>
#include <string>
#include <any>
#include <map>
#include <thread>
#define GLFW_INCLUDE_NONE
#include "GLFW/glfw3.h"
#include "glad.h"
#include "glm/glm.hpp"
#include "hack/logger/logger.hpp"
#include "imgui.h"
#include "imgui_impl_glfw.h"
#include "imgui_impl_opengl3.h"
#include "nlohmann/json.hpp"

View File

@ -0,0 +1,122 @@
#pragma once
#include <stdint.h>
namespace try_engine::key
{
enum : uint16_t
{
// из glfw3.h
SPACE = 32,
APOSTROPHE = 39, /* ' */
COMMA = 44, /* , */
MINUS = 45, /* - */
PERIOD = 46, /* . */
SLASH = 47, /* / */
D0 = 48, /* 0 */
D1 = 49, /* 1 */
D2 = 50, /* 2 */
D3 = 51, /* 3 */
D4 = 52, /* 4 */
D5 = 53, /* 5 */
D6 = 54, /* 6 */
D7 = 55, /* 7 */
D8 = 56, /* 8 */
D9 = 57, /* 9 */
SEMICOLON = 59, /* ; */
EQUAL = 61, /* = */
A = 65,
B = 66,
C = 67,
D = 68,
E = 69,
F = 70,
G = 71,
H = 72,
I = 73,
J = 74,
K = 75,
L = 76,
M = 77,
N = 78,
O = 79,
P = 80,
Q = 81,
R = 82,
S = 83,
T = 84,
U = 85,
V = 86,
W = 87,
X = 88,
Y = 89,
Z = 90,
LEFTBRACKET = 91, /* [ */
BACKSLASH = 92, /* \ */
RIGHTBRACKET = 93, /* ] */
GRAVEACCENT = 96, /* ` */
WORLD1 = 161, /* non-US #1 */
WORLD2 = 162, /* non-US #2 */
ESCAPE = 256,
ENTER = 257,
TAB = 258,
BACKSPACE = 259,
INSERT = 260,
DELETE = 261,
RIGHT = 262,
LEFT = 263,
DOWN = 264,
UP = 265,
PAGEUP = 266,
PAGEDOWN = 267,
HOME = 268,
END = 269,
CAPSLOCK = 280,
SCROLLLOCK = 281,
NUMLOCK = 282,
PRINTSCREEN = 283,
PAUSE = 284,
F1 = 290,
F2 = 291,
F3 = 292,
F4 = 293,
F5 = 294,
F6 = 295,
F7 = 296,
F8 = 297,
F9 = 298,
F10 = 299,
F11 = 300,
F12 = 301,
F13 = 302,
F14 = 303,
F15 = 304,
F16 = 305,
F17 = 306,
F18 = 307,
F19 = 308,
F20 = 309,
F21 = 310,
F22 = 311,
F23 = 312,
F24 = 313,
F25 = 314,
LEFTSHIFT = 340,
LEFTCONTROL = 341,
LEFTALT = 342,
LEFTSUPER = 343,
RIGHTSHIFT = 344,
RIGHTCONTROL = 345,
RIGHTALT = 346,
RIGHTSUPER = 347,
MENU = 348
};
}

View File

@ -0,0 +1,35 @@
#pragma once
#include "using.hpp"
namespace try_engine::time
{
template<typename Time>
class timestep
{
public:
timestep(Time data_ = 0.0f) : data { data_ } {}
operator Time() const { return data; }
Time get_seconds() const { return data; }
Time get_milliseconds() const { return data * 1000.0f; }
private:
Time data;
};
}
namespace try_engine::time
{
inline timestep<float> get_time()
{
static float frame_time = 0.0f;
float t = (float)glfwGetTime();
timestep<float> ts = t - frame_time;
frame_time = t;
return ts;
}
}

View File

@ -0,0 +1,14 @@
#pragma once
#include "include.hpp"
namespace try_engine
{
template<typename Event>
using event_callback = std::function<void(Event&)>;
using JSON = nlohmann::json;
}

View File

@ -0,0 +1,5 @@
#pragma once
#include "keycode.hpp"
#include "define.hpp"
#include "time.hpp"

View File

@ -0,0 +1,27 @@
#include "graphic_context.hpp"
namespace try_engine
{
graphic_context::graphic_context(GLFWwindow* w) : m_win { w } {}
void graphic_context::init()
{
glfwMakeContextCurrent(m_win);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
hack::log(": ")("Glad loader status", status == 1 ? "true" : "false");
hack::log(": ")("OpenGL Info");
hack::log(": ")(" Vendor", glGetString(GL_VENDOR));
hack::log(": ")(" Renderer", glGetString(GL_RENDERER));
hack::log(": ")(" Version", glGetString(GL_VERSION));
hack::log(": ")(" GLSL Version", glGetString(GL_SHADING_LANGUAGE_VERSION));
glfwSwapInterval(1);
}
void graphic_context::swap_buffers()
{
glfwSwapBuffers(m_win);
}
}

View File

@ -0,0 +1,19 @@
#pragma once
#include "try_engine/utils/utils.hpp"
namespace try_engine
{
class graphic_context
{
public:
graphic_context(GLFWwindow*);
private:
GLFWwindow* m_win;
public:
void init();
void swap_buffers();
};
}

View File

@ -0,0 +1,205 @@
#include "window.hpp"
#include "renderer/renderer.hpp"
#include "event/system_event/category/key_event.hpp"
#include "event/system_event/category/window_event.hpp"
namespace try_engine
{
window::window(std::string app_name)
{
if (!glfwInit())
exit(EXIT_FAILURE);
m_window_data.m_name = app_name;
set_hint();
set_window();
set_context();
set_pointer();
set_key_callback();
set_window_callback();
hack::log(": ")("Creating window", m_window_data.m_name);
hack::log(" = ")("w", m_window_data.m_width);
hack::log(" = ")("h", m_window_data.m_height);
}
window::~window()
{
glfwDestroyWindow(m_win);
glfwTerminate();
hack::warn(": ")("destroy", "window", m_window_data.m_name);
}
void window::set_hint()
{
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_SAMPLES, 4);
}
void window::set_window()
{
m_win = glfwCreateWindow(
glfwGetVideoMode(glfwGetPrimaryMonitor())->width,
glfwGetVideoMode(glfwGetPrimaryMonitor())->height,
m_window_data.m_name.c_str(),
nullptr, nullptr
);
if(m_win == NULL)
{
hack::error()("Failed to create GLFW window");
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwGetWindowSize(m_win, &m_window_data.m_width, &m_window_data.m_height);
}
void window::set_context()
{
m_graphic_context = std::make_unique<graphic_context>(m_win);
m_graphic_context->init();
}
void window::set_pointer()
{
glfwSetWindowUserPointer(m_win, &m_window_data);
}
void window::set_event_callback(const event_callback<system_event::event>& cb)
{
m_window_data.on_callback = cb;
}
GLFWwindow* window::glfw_window() const
{
return m_win;
}
int window::width() const
{
return m_window_data.m_width;
}
int window::height() const
{
return m_window_data.m_height;
}
void window::update()
{
glfwPollEvents();
m_graphic_context->swap_buffers();
}
void window::clear() const
{
renderer::set_color({ 0.1f, 0.1f, 0.1f, 1 });
renderer::clear();
}
void window::set_key_callback()
{
glfwSetKeyCallback(m_win, [](GLFWwindow* w, int key, int scancode, int action, int mods)
{
auto data = static_cast<window_data*>(glfwGetWindowUserPointer(w));
switch (action)
{
case GLFW_PRESS:
{
system_event::key_pressed_event e { key };
data->on_callback(e);
break;
}
case GLFW_RELEASE:
{
system_event::key_released_event e { key };
data->on_callback(e);
break;
}
case GLFW_REPEAT:
{
system_event::key_pressed_event e { key };
data->on_callback(e);
break;
}
}
});
// HERE
// это нужнореализовать и в событиях
// там есть классы которые нужно разобрать и привести в порядок
//
// glfwSetMouseButtonCallback(win, [](GLFWwindow* window, int button, int action, int mods)
// {
// auto data = static_cast<window_data*>(glfwGetWindowUserPointer(w));
//
// switch (action)
// {
// case GLFW_PRESS:
// {
// system_event::mouse_button_pressed_event e { button };
// data->callback(e);
// break;
// }
// case GLFW_RELEASE:
// {
// MouseButtonReleasedEvent event{button};
// data.EventCallback(event);
// break;
// }
// }
// });
// glfwSetScrollCallback(win, [](GLFWwindow* window, double xOffset, double yOffset)
// {
// WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
//
// MouseScrolledEvent event{(float)xOffset, (float)yOffset};
// data.EventCallback(event);
// });
//
// glfwSetCursorPosCallback(win, [](GLFWwindow* window, double xPos, double yPos)
// {
// WindowData& data = *(WindowData*)glfwGetWindowUserPointer(window);
//
// MouseMovedEvent event{(float)xPos, (float)yPos};
// data.EventCallback(event);
// });
}
void window::set_window_callback()
{
glfwSetWindowSizeLimits(m_win, m_window_data.m_width, m_window_data.m_height, GLFW_DONT_CARE, GLFW_DONT_CARE);
glfwSetWindowSizeCallback(m_win, [](GLFWwindow* w, int width, int height)
{
auto data = static_cast<window_data*>(glfwGetWindowUserPointer(w));
data->m_width = width;
data->m_height = height;
system_event::window_resize_event e { width, height };
data->on_callback(e);
});
glfwSetWindowCloseCallback(m_win, [](GLFWwindow* w)
{
auto data = static_cast<window_data*>(glfwGetWindowUserPointer(w));
system_event::window_close_event e;
data->on_callback(e);
});
glfwSetWindowFocusCallback(m_win, [](GLFWwindow* w, int focused)
{
auto data = static_cast<window_data*>(glfwGetWindowUserPointer(w));
system_event::window_focus_event e { focused };
data->on_callback(e);
});
}
}

View File

@ -0,0 +1,50 @@
#pragma once
#include "try_engine/utils/utils.hpp"
#include "graphic_context/graphic_context.hpp"
#include "try_engine/event/system_event/event.hpp"
namespace try_engine
{
class window
{
public:
window(std::string);
~window();
// HERE
// реализовать остальные конструкторы
private:
// ни каких unique_ptr тут неполучится
// т.к. glfwCreateWindow maloc-ом выделяет память
// что не есть хорошо для умных указателей
GLFWwindow* m_win;
std::unique_ptr<graphic_context> m_graphic_context;
struct window_data
{
std::string m_name;
int m_width, m_height;
event_callback<system_event::event> on_callback;
} m_window_data;
public:
void update();
GLFWwindow* glfw_window() const;
void clear() const ;
int width() const;
int height() const;
void set_event_callback(const event_callback<system_event::event>&);
void set_window_callback();
private:
void set_hint();
void set_window();
void set_context();
void set_pointer();
void set_key_callback();
};
}

11
src/TMP/tests/meson.build Executable file
View File

@ -0,0 +1,11 @@
# gtest_proj = subproject('gtest')
# gtest_dep = gtest_proj.get_variable('gtest_main_dep')
#
# test(
# 'hello',
# executable(
# 'hello',
# 'hello.cpp',
# dependencies: [ hello_dep, gtest_dep ]
# )
# )

14
src/VE.hpp Executable file
View File

@ -0,0 +1,14 @@
#pragma once
#include "utils/utils.hpp"
#include "application/application.hpp"
#include "event/event.hpp"
#include "layer/layer.hpp"
#include "glfw/glfw.hpp"
#include "gui/gui.hpp"
#include "gui/style/icons.hpp"
#include "gui/style/fonts.hpp"
#include "opengl/opengl.hpp"

55
src/application/application.cpp Executable file
View File

@ -0,0 +1,55 @@
#include "application.hpp"
#include "utils/utils.hpp"
namespace VE
{
application::application(std::string app_name) : m_glfw{ std::make_unique<glfw>() }
{
m_glfw->init(app_name);
m_glfw->set_event_fn(VE_EVENT_FN);
m_gui = std::make_unique<gui>(m_glfw);
}
void application::run()
{
glEnable(GL_DEPTH_TEST);
glClearColor(0.07f, 0.13f, 0.17f, 1.0f);
glViewport(0, 0, m_glfw->width(), m_glfw->height());
while(!glfwWindowShouldClose(m_glfw->get_win()))
{
m_glfw->clear();
m_gui->begin_frame();
for (auto l : m_layers_stack) l->render();
m_gui->end_frame();
m_glfw->update();
}
}
std::unique_ptr<glfw>& application::get_glfw()
{
return m_glfw;
}
void application::attach_layers()
{
for (auto l : m_layers_stack) l->on_attach();
}
void application::set_event_fn()
{
for (const auto l : m_layers_stack) l->set_event_fn(VE_EVENT_FN);
}
void application::on_event(event& e)
{
if (e.is_parallele)
for (auto l : m_layers_stack) auto future = std::async(std::launch::async, [&]() { l->on_event(e); });
else
for (auto l : m_layers_stack) l->on_event(e);
}
}

42
src/application/application.hpp Executable file
View File

@ -0,0 +1,42 @@
#pragma once
#include "glfw/glfw.hpp"
#include "gui/gui.hpp"
#include "layer/layer.hpp"
namespace VE
{
class application
{
public:
application(std::string app_name);
virtual ~application() = default;
private:
std::unique_ptr<glfw> m_glfw;
std::unique_ptr<gui> m_gui;
layers_stack<layer> m_layers_stack;
public:
void run();
std::unique_ptr<glfw>& get_glfw();
public:
template<typename... Args>
void push_layer(Args*... args)
{
(m_layers_stack.push_back(args), ...);
attach_layers();
set_event_fn();
}
private:
void clear();
void attach_layers();
void set_event_fn();
void on_event(event& e);
};
// реализация см. в проекте
application& create();
}

32
src/event/event.hpp Executable file
View File

@ -0,0 +1,32 @@
#pragma once
#include "utils/utils.hpp"
namespace VE
{
enum class event_type
{
KEY_PRESSED,
KEY_RELEASED,
KEY_REPEATE,
MOUSE_BUTTON_PRESSED,
MOUSE_BUTTON_RELEASED,
MOUSE_CURSOR_POSITION,
MOUSE_SCROLL,
WINDOW_RESIZE,
WINDOW_CLOSE,
WINDOW_FOCUS,
};
struct event
{
event(std::any t, std::any d) : m_type{ t }, m_data{ d } {}
~event() = default;
std::any m_type;
std::any m_data;
bool is_parallele{ false };
};
}

26
src/glfw/context/context.cpp Executable file
View File

@ -0,0 +1,26 @@
#include "context.hpp"
namespace VE
{
context::context(GLFWwindow* w) : m_win { w }
{
glfwMakeContextCurrent(m_win);
int status = gladLoadGLLoader((GLADloadproc)glfwGetProcAddress);
hack::log(": ")("Glad loader status", status == 1 ? "Load" : "UNLOAD");
hack::log(": ")("OpenGL Info");
hack::log(": ")(" Vendor", glGetString(GL_VENDOR));
hack::log(": ")(" Renderer", glGetString(GL_RENDERER));
hack::log(": ")(" Version", glGetString(GL_VERSION));
hack::log(": ")(" GLSL Version", glGetString(GL_SHADING_LANGUAGE_VERSION));
glfwSwapInterval(1);
}
void context::swap_buffers()
{
glfwSwapBuffers(m_win);
}
}

19
src/glfw/context/context.hpp Executable file
View File

@ -0,0 +1,19 @@
#pragma once
#include "utils/utils.hpp"
namespace VE
{
class context
{
public:
context(GLFWwindow* w);
private:
GLFWwindow* m_win;
public:
void init();
void swap_buffers();
};
}

215
src/glfw/glfw.cpp Executable file
View File

@ -0,0 +1,215 @@
#include "glfw.hpp"
// #include "renderer/renderer.hpp"
// #include "event/system_event/category/key_event.hpp"
// #include "event/system_event/category/window_event.hpp"
namespace VE
{
glfw::glfw()
{
if (!glfwInit())
{
hack::error()("Not glfw window init");
std::terminate();
}
}
glfw::~glfw()
{
hack::warn(": ")("Destroy glfw window", m_win_data.m_name);
glfwDestroyWindow(m_win);
glfwTerminate();
}
void glfw::init(std::string win_name)
{
m_win_data.m_name = win_name;
set_hint();
set_window();
set_graphic_context();
set_pointer();
set_key_callback();
set_mouse_callback();
set_window_callback();
}
void glfw::set_hint()
{
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 4);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 5);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_SAMPLES, 4);
hack::log()("Set glfw window hint");
}
void glfw::set_window()
{
// два полследних nullptr
// первый - устанавливает монитор на ктором будетоткрытие(основной, дополнительнй)
// второй - делиться ли ресурсами с кем-то
m_win = glfwCreateWindow(
glfwGetVideoMode(glfwGetPrimaryMonitor())->width,
glfwGetVideoMode(glfwGetPrimaryMonitor())->height,
m_win_data.m_name.c_str(),
nullptr, nullptr
);
if(m_win == NULL)
{
hack::error()("Failed to create GLFW window");
glfwTerminate();
std::terminate();
}
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(" = ")(" width", m_win_data.m_width);
hack::log(" = ")(" height", m_win_data.m_height);
}
void glfw::set_graphic_context()
{
m_context = std::make_unique<context>(m_win);
hack::log()("Set context");
}
void glfw::set_pointer()
{
glfwSetWindowUserPointer(m_win, &m_win_data);
}
GLFWwindow* glfw::get_win() const
{
return m_win;
}
int glfw::width() const
{
return m_win_data.m_width;
}
int glfw::height() const
{
return m_win_data.m_height;
}
void glfw::update()
{
glfwPollEvents();
m_context->swap_buffers();
}
void glfw::clear() const
{
glClearColor(m_bgcolor.r, m_bgcolor.g, m_bgcolor.b, m_bgcolor.a);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
}
void glfw::set_event_fn(const event_fn<event>& fn)
{
m_win_data.execute = fn;
}
void glfw::set_key_callback()
{
glfwSetKeyCallback(m_win, [](GLFWwindow* w, int key, int scancode, int action, int mods)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ action, key };
switch (action)
{
case GLFW_PRESS:
{
e.m_type = event_type::KEY_PRESSED;
break;
}
case GLFW_RELEASE:
{
e.m_type = event_type::KEY_RELEASED;
break;
}
case GLFW_REPEAT:
{
e.m_type = event_type::KEY_REPEATE;
break;
}
}
d->execute(e);
});
}
void glfw::set_mouse_callback()
{
glfwSetMouseButtonCallback(m_win, [](GLFWwindow* w, int button, int action, int mods)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ action, button };
switch (action)
{
case GLFW_PRESS:
{
e.m_type = event_type::MOUSE_BUTTON_PRESSED;
break;
}
case GLFW_RELEASE:
{
e.m_type = event_type::MOUSE_BUTTON_RELEASED;
break;
}
}
d->execute(e);
});
glfwSetScrollCallback(m_win, [](GLFWwindow* w, double xOffset, double yOffset)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ event_type::MOUSE_SCROLL, std::pair<float, float>{ static_cast<float>(xOffset), static_cast<float>(yOffset) } };
d->execute(e);
});
glfwSetCursorPosCallback(m_win, [](GLFWwindow* w, double xPos, double yPos)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ event_type::MOUSE_CURSOR_POSITION, std::pair<float, float>{ static_cast<float>(xPos), static_cast<float>(yPos) } };
d->execute(e);
});
}
void glfw::set_window_callback()
{
glfwSetWindowSizeLimits(m_win, m_win_data.m_width, m_win_data.m_height, GLFW_DONT_CARE, GLFW_DONT_CARE);
glfwSetWindowSizeCallback(m_win, [](GLFWwindow* w, int width, int height)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
d->m_width = width;
d->m_height = height;
event e{ event_type::WINDOW_RESIZE, std::pair<float, float>{ static_cast<float>(width), static_cast<float>(height) } };
d->execute(e);
});
glfwSetWindowCloseCallback(m_win, [](GLFWwindow* w)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ event_type::WINDOW_CLOSE, nullptr };
d->execute(e);
});
glfwSetWindowFocusCallback(m_win, [](GLFWwindow* w, int focused)
{
auto d = static_cast<win_data*>(glfwGetWindowUserPointer(w));
event e{ event_type::WINDOW_FOCUS, focused };
d->execute(e);
});
}
}

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();
};
}

38
src/gui/flags.hpp Normal file
View File

@ -0,0 +1,38 @@
#pragma once
#include "utils/utils.hpp"
namespace VE
{
struct flags
{
flags()
{
if (m_no_titlebar) m_window_flags |= ImGuiWindowFlags_NoTitleBar;
if (m_no_scrollbar) m_window_flags |= ImGuiWindowFlags_NoScrollbar;
if (!m_no_menu) m_window_flags |= ImGuiWindowFlags_MenuBar;
if (m_no_move) m_window_flags |= ImGuiWindowFlags_NoMove;
if (m_no_resize) m_window_flags |= ImGuiWindowFlags_NoResize;
if (m_no_collapse) m_window_flags |= ImGuiWindowFlags_NoCollapse;
if (m_no_nav) m_window_flags |= ImGuiWindowFlags_NoNav;
if (m_no_background) m_window_flags |= ImGuiWindowFlags_NoBackground;
if (m_no_bring_to_front) m_window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus;
}
virtual ~flags() = default;
bool m_p_open = false;
bool m_no_titlebar = true;
bool m_no_scrollbar = true;
bool m_no_menu = true;
bool m_no_move = true;
bool m_no_resize = true;
bool m_no_collapse = true;
bool m_no_nav = false;
bool m_no_background = false;
bool m_no_bring_to_front = false;
bool m_no_docking = true;
ImGuiWindowFlags m_window_flags = 0;
};
}

54
src/gui/gui.cpp Executable file
View File

@ -0,0 +1,54 @@
#include "gui.hpp"
#include "style/style.hpp"
namespace VE
{
gui::gui(std::unique_ptr<glfw>& g) : m_glfw { g }
{
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGuiIO& io = ImGui::GetIO(); (void)io;
io.ConfigFlags |= ImGuiConfigFlags_NavEnableKeyboard;
io.IniFilename = nullptr;
ImGuiStyle& style = ImGui::GetStyle();
if (io.ConfigFlags)
{
style.WindowRounding = 0.0f;
style.Colors[ImGuiCol_WindowBg].w = 1.0f;
}
GLFWwindow* window = m_glfw->get_win();
ImGui_ImplGlfw_InitForOpenGL(window, true);
ImGui_ImplOpenGL3_Init("#version 410");
style::init();
}
gui::~gui()
{
ImGui_ImplOpenGL3_Shutdown();
ImGui_ImplGlfw_Shutdown();
ImGui::DestroyContext();
}
void gui::begin_frame()
{
ImGui_ImplOpenGL3_NewFrame();
ImGui_ImplGlfw_NewFrame();
ImGui::NewFrame();
}
void gui::end_frame()
{
ImGuiIO& io = ImGui::GetIO();
io.DisplaySize = ImVec2((float)m_glfw->width(), (float)m_glfw->height());
ImGui::Render();
ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
}
}

21
src/gui/gui.hpp Executable file
View File

@ -0,0 +1,21 @@
#pragma once
#include "utils/utils.hpp"
#include "glfw/glfw.hpp"
namespace VE
{
class gui
{
public:
gui(std::unique_ptr<glfw>& g);
~gui();
public:
void begin_frame();
void end_frame();
private:
std::unique_ptr<glfw>& m_glfw;
};
}

99
src/gui/style/fonts.hpp Executable file
View File

@ -0,0 +1,99 @@
#pragma once
#include <string>
#include <vector>
#include <map>
#include "imgui.h"
#include "icons.hpp"
#include "utils/utils.hpp"
namespace VE::style::fonts
{
inline std::string font_name = "/Montserrat/Montserrat-";
inline std::vector<float> font_size = { 8.f, 9.f, 10.f, 11.f, 12.f, 13.f, 14.f, 15.f, 16.f, 17.f, 18.f, 19.f, 20.f, 21.f, 22.f };
enum font_type
{
BOLD, BOLD_ITALIC, EXTRA_BOLD, EXTRA_BOLD_ITALIC, EXTRA_LIGHT, EXTRA_LIGHT_ITALIC,
ITALIC, LIGHT, LIGHT_ITALIC, MEDIUM, MEDIUM_ITALIC, REGULAR, SEMI_BOLD, SEMI_BOLD_ITALIC, THIN, THIN_ITALIC, ICON
};
inline std::vector<std::string> fonts_path
{
var::FONT_PATH + font_name + "Bold.ttf",
var::FONT_PATH + font_name + "BoldItalic.ttf",
var::FONT_PATH + font_name + "ExtraBold.ttf",
var::FONT_PATH + font_name + "ExtraBoldItalic.ttf",
var::FONT_PATH + font_name + "ExtraLight.ttf",
var::FONT_PATH + font_name + "ExtraLightItalic.ttf",
var::FONT_PATH + font_name + "Italic.ttf",
var::FONT_PATH + font_name + "Light.ttf",
var::FONT_PATH + font_name + "LightItalic.ttf",
var::FONT_PATH + font_name + "Medium.ttf",
var::FONT_PATH + font_name + "MediumItalic.ttf",
var::FONT_PATH + font_name + "Regular.ttf",
var::FONT_PATH + font_name + "SemiBold.ttf",
var::FONT_PATH + font_name + "SemiBoldItalic.ttf",
var::FONT_PATH + font_name + "Thin.ttf",
var::FONT_PATH + font_name + "ThinItalic.ttf"
};
inline std::map<font_type, int> font_step
{
{ font_type::BOLD, 0 },
{ font_type::BOLD_ITALIC, 15 },
{ font_type::EXTRA_BOLD, 30 },
{ font_type::EXTRA_BOLD_ITALIC, 45 },
{ font_type::EXTRA_LIGHT, 60 },
{ font_type::EXTRA_LIGHT_ITALIC, 75 },
{ font_type::ITALIC, 90 },
{ font_type::LIGHT, 105 },
{ font_type::LIGHT_ITALIC, 120 },
{ font_type::MEDIUM, 135 },
{ font_type::MEDIUM_ITALIC, 150 },
{ font_type::REGULAR, 165 },
{ font_type::SEMI_BOLD, 180 },
{ font_type::SEMI_BOLD_ITALIC, 195 },
{ font_type::THIN, 210 },
{ font_type::THIN_ITALIC, 225 },
{ font_type::ICON, 240 },
};
inline void init()
{
ImGuiIO& io = ImGui::GetIO();
for (auto& p : fonts_path)
for (auto size : font_size)
io.Fonts->AddFontFromFileTTF(p.c_str(), size, NULL, io.Fonts->GetGlyphRangesCyrillic());
// add icon font size
static const ImWchar icon_ranges[] = { ICON_MIN_FK, ICON_MAX_FK, 0 };
for (auto size : font_size)
io.Fonts->AddFontFromFileTTF(var::ICONS_PATH.c_str(), size, NULL, icon_ranges);
};
inline ImFont* get_font(font_type type = font_type::REGULAR, int size = 16)
{
if (size < 0) size = 8;
if (size > 33) size = 33;
size -= 8; // т.к. font_size начинается с 8.f
ImGuiIO& io = ImGui::GetIO();
ImFontAtlas* atlas = io.Fonts;
auto pos = font_step[type] + size;
return atlas->Fonts[pos];
};
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More