From 5a829fad05054f77507509881ba5ce3f54d4dd5e Mon Sep 17 00:00:00 2001 From: chatlanin Date: Sun, 26 Feb 2023 15:16:48 +0300 Subject: [PATCH] initial commit --- .gitignore | 12 + README.md | 0 bin/main.cpp | 7 + bin/meson.build | 6 + meson.build | 60 ++ props.json | 2 + run | 13 + src/core/application/application.cpp | 54 ++ src/core/application/application.hpp | 40 + src/core/core.hpp | 14 + .../event/app_event/category/event_type.hpp | 13 + src/core/event/app_event/event.hpp | 33 + src/core/event/event_classificator.hpp | 13 + .../event/system_event/category/key_event.hpp | 38 + .../system_event/category/window_event.hpp | 49 ++ src/core/event/system_event/event.hpp | 14 + src/core/gui/gui.cpp | 60 ++ src/core/gui/gui.hpp | 17 + src/core/gui/style/fonts.hpp | 46 ++ src/core/gui/style/icons.hpp | 719 ++++++++++++++++++ src/core/gui/style/style.hpp | 82 ++ src/core/layer/layer.hpp | 33 + src/core/meson.build | 32 + src/core/renderer/renderer.cpp | 14 + src/core/renderer/renderer.hpp | 22 + src/core/renderer/texture/texture.cpp | 27 + src/core/renderer/texture/texture.hpp | 26 + src/core/utils/define.hpp | 67 ++ src/core/utils/include.hpp | 40 + src/core/utils/timestap.hpp | 22 + src/core/utils/variable.hpp | 10 + .../graphic_context/graphic_context.cpp | 27 + .../graphic_context/graphic_context.hpp | 18 + src/core/window/window.cpp | 158 ++++ src/core/window/window.hpp | 46 ++ src/engine/buffer/buffer.hpp | 34 + src/engine/content/content.cpp | 35 + src/engine/content/content.hpp | 42 + src/engine/content/file/file.cpp | 39 + src/engine/content/file/file.hpp | 120 +++ src/engine/content/history/history.cpp | 14 + src/engine/content/history/history.hpp | 19 + src/engine/content/navigation/navigation.cpp | 15 + src/engine/content/navigation/navigation.hpp | 21 + src/engine/content/preview/preview.cpp | 12 + src/engine/content/preview/preview.hpp | 17 + src/engine/engine.hpp | 61 ++ .../layers/gui/browser/history/history.cpp | 48 ++ .../layers/gui/browser/history/history.hpp | 37 + .../gui/browser/navigation/navigation.cpp | 74 ++ .../gui/browser/navigation/navigation.hpp | 41 + .../layers/gui/browser/preview/preview.cpp | 49 ++ .../layers/gui/browser/preview/preview.hpp | 37 + src/engine/meson.build | 39 + src/engine/sandbox/demo.hpp | 45 ++ src/meson.build | 4 + subprojects/glad.wrap | 6 + subprojects/glfw.wrap | 13 + subprojects/glm.wrap | 12 + subprojects/gtest.wrap | 15 + subprojects/hack.wrap | 6 + subprojects/imgui.wrap | 12 + subprojects/nlohmann_json.wrap | 10 + subprojects/taglib.wrap | 12 + tests/meson.build | 11 + 65 files changed, 2734 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 bin/main.cpp create mode 100644 bin/meson.build create mode 100644 meson.build create mode 100644 props.json create mode 100755 run create mode 100644 src/core/application/application.cpp create mode 100644 src/core/application/application.hpp create mode 100644 src/core/core.hpp create mode 100644 src/core/event/app_event/category/event_type.hpp create mode 100644 src/core/event/app_event/event.hpp create mode 100644 src/core/event/event_classificator.hpp create mode 100644 src/core/event/system_event/category/key_event.hpp create mode 100644 src/core/event/system_event/category/window_event.hpp create mode 100644 src/core/event/system_event/event.hpp create mode 100644 src/core/gui/gui.cpp create mode 100644 src/core/gui/gui.hpp create mode 100644 src/core/gui/style/fonts.hpp create mode 100644 src/core/gui/style/icons.hpp create mode 100644 src/core/gui/style/style.hpp create mode 100644 src/core/layer/layer.hpp create mode 100644 src/core/meson.build create mode 100644 src/core/renderer/renderer.cpp create mode 100644 src/core/renderer/renderer.hpp create mode 100644 src/core/renderer/texture/texture.cpp create mode 100644 src/core/renderer/texture/texture.hpp create mode 100644 src/core/utils/define.hpp create mode 100644 src/core/utils/include.hpp create mode 100644 src/core/utils/timestap.hpp create mode 100644 src/core/utils/variable.hpp create mode 100644 src/core/window/graphic_context/graphic_context.cpp create mode 100644 src/core/window/graphic_context/graphic_context.hpp create mode 100644 src/core/window/window.cpp create mode 100644 src/core/window/window.hpp create mode 100644 src/engine/buffer/buffer.hpp create mode 100644 src/engine/content/content.cpp create mode 100644 src/engine/content/content.hpp create mode 100644 src/engine/content/file/file.cpp create mode 100644 src/engine/content/file/file.hpp create mode 100644 src/engine/content/history/history.cpp create mode 100644 src/engine/content/history/history.hpp create mode 100644 src/engine/content/navigation/navigation.cpp create mode 100644 src/engine/content/navigation/navigation.hpp create mode 100644 src/engine/content/preview/preview.cpp create mode 100644 src/engine/content/preview/preview.hpp create mode 100644 src/engine/engine.hpp create mode 100644 src/engine/layers/gui/browser/history/history.cpp create mode 100644 src/engine/layers/gui/browser/history/history.hpp create mode 100644 src/engine/layers/gui/browser/navigation/navigation.cpp create mode 100644 src/engine/layers/gui/browser/navigation/navigation.hpp create mode 100644 src/engine/layers/gui/browser/preview/preview.cpp create mode 100644 src/engine/layers/gui/browser/preview/preview.hpp create mode 100644 src/engine/meson.build create mode 100644 src/engine/sandbox/demo.hpp create mode 100644 src/meson.build create mode 100644 subprojects/glad.wrap create mode 100644 subprojects/glfw.wrap create mode 100644 subprojects/glm.wrap create mode 100644 subprojects/gtest.wrap create mode 100644 subprojects/hack.wrap create mode 100644 subprojects/imgui.wrap create mode 100644 subprojects/nlohmann_json.wrap create mode 100644 subprojects/taglib.wrap create mode 100644 tests/meson.build diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..782dcf1 --- /dev/null +++ b/.gitignore @@ -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 + diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/bin/main.cpp b/bin/main.cpp new file mode 100644 index 0000000..b95267f --- /dev/null +++ b/bin/main.cpp @@ -0,0 +1,7 @@ +#include "engine/engine.hpp" + +auto main(int argc, char* args[]) -> int +{ + decltype(auto) app = tr::core::create_app(); + app.run(); +} diff --git a/bin/meson.build b/bin/meson.build new file mode 100644 index 0000000..3aaf0af --- /dev/null +++ b/bin/meson.build @@ -0,0 +1,6 @@ +executable( + 'rrr.v2', + 'main.cpp', + dependencies : deps, + cpp_args: args +) diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..6ea5ea4 --- /dev/null +++ b/meson.build @@ -0,0 +1,60 @@ +project( + 'rrr.v2', + 'cpp', + version : run_command('jq', '-r', '.version', join_paths(meson.source_root(), 'props.json'), check: true).stdout().strip(), + default_options : [ + 'warning_level=1', + 'optimization=3', + 'default_library=static', + 'cpp_std=c++20', +]) + +add_project_arguments ( + '-Wpedantic', + '-Wno-shadow', + '-Wno-unused-but-set-variable', + '-Wno-comment', + '-Wno-unused-parameter', + '-Wno-unused-value', + '-Wno-missing-field-initializers', + '-Wno-narrowing', + '-Wno-deprecated-enum-enum-conversion', + '-Wno-volatile', + '-Wno-deprecated-declarations', + language: 'cpp' +) + +############################################################# + +#args = ['-lglfw', '-ldl', '-lGL', '-lpthread', '-lX11', '-lXxf86vm', '-lXrandr', '-lXi'] +args = [ + '-lopenal', + '-lsndfile', + '-lmpg123', +] + +deps = [ + dependency('TBB'), + dependency('OpenCV'), + dependency('uuid'), + dependency('threads'), + dependency('opengl'), + subproject('glfw').get_variable('glfw_dep'), + subproject('glad').get_variable('glad_dep'), + subproject('hack').get_variable('logger_dep'), + subproject('imgui').get_variable('imgui_dep'), + subproject('glm').get_variable('glm_dep'), + subproject('nlohmann_json').get_variable('nlohmann_json_dep'), + subproject('taglib').get_variable('taglib_dep'), + dependency('openal'), + dependency('libmpg123'), + dependency('sndfile'), +] + +inc = [] + +############################################################# + +subdir('src') +subdir('bin') +#subdir('tests') diff --git a/props.json b/props.json new file mode 100644 index 0000000..a02e9e6 --- /dev/null +++ b/props.json @@ -0,0 +1,2 @@ +{"version": "1.0.0"} + diff --git a/run b/run new file mode 100755 index 0000000..c9b6881 --- /dev/null +++ b/run @@ -0,0 +1,13 @@ +#!/bin/zsh + +PROJECT_NAME="rrr.v2" + +command meson compile -C build + +if [[ -z "$1" ]]; then + cd build + ./bin/$PROJECT_NAME + cd .. +else + meson test $1 -C build +fi diff --git a/src/core/application/application.cpp b/src/core/application/application.cpp new file mode 100644 index 0000000..5cc809f --- /dev/null +++ b/src/core/application/application.cpp @@ -0,0 +1,54 @@ +#include "application.hpp" + +#include "utils/define.hpp" + +namespace tr::core +{ + application::application() + { + instance = std::unique_ptr(this); + + win = std::make_unique(); + win->set_event_callback(BIND_EVENT_FN(application, on_event)); + + ui = std::make_unique(); + } + + void application::run() + { + while(!glfwWindowShouldClose(win->glfw_window())) + { + win->clear(); + + for (auto l : l_stack) + l->on_update(time::get_time()); + + ui->begin_frame(); + for (auto l : l_stack) + l->gui_render(); + ui->end_frame(); + + win->update(); + } + } + + std::unique_ptr& application::get_window() + { + return win; + } + + std::unique_ptr& application::get() + { + return instance; + } + + void application::attach_layers() + { + for (auto l : l_stack) l->on_attach(); + } + + void application::on_event(system_event::event& e) + { + for(const auto l : l_stack) l->on_event(e); + } +} diff --git a/src/core/application/application.hpp b/src/core/application/application.hpp new file mode 100644 index 0000000..20ee2a5 --- /dev/null +++ b/src/core/application/application.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include "core/window/window.hpp" +#include "core/gui/gui.hpp" +#include "core/layer/layer.hpp" + +namespace tr::core +{ + class application + { + using layers_stack = std::vector; + + public: + application(); + virtual ~application() = default; + + public: + void run(); + void attach_layers(); + std::unique_ptr& get_window(); + static std::unique_ptr& get(); + + public: + template + void push_layer(Args*... args) { (l_stack.push_back(args), ...); } + + private: + inline static std::unique_ptr instance = nullptr; + std::unique_ptr win; + layers_stack l_stack; + + private: + void clear(); + std::unique_ptr ui; + void on_event(system_event::event& e); + }; + + // реализация см. engine + application& create_app(); +} diff --git a/src/core/core.hpp b/src/core/core.hpp new file mode 100644 index 0000000..e0622ce --- /dev/null +++ b/src/core/core.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "core/gui/style/style.hpp" + +#include "core/application/application.hpp" + +#include "event/event_classificator.hpp" +#include "event/system_event/event.hpp" +#include "event/app_event/event.hpp" + +#include "core/renderer/renderer.hpp" +#include "core/renderer/texture/texture.hpp" + +#include "utils/timestap.hpp" diff --git a/src/core/event/app_event/category/event_type.hpp b/src/core/event/app_event/category/event_type.hpp new file mode 100644 index 0000000..3deabe1 --- /dev/null +++ b/src/core/event/app_event/category/event_type.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "core/utils/define.hpp" +#include "core/event/system_event/event.hpp" + +namespace tr::core::app_event +{ + enum class event_type : unsigned int + { + NONE = 0, + SET_LOG, + }; +} diff --git a/src/core/event/app_event/event.hpp b/src/core/event/app_event/event.hpp new file mode 100644 index 0000000..a2fbfe3 --- /dev/null +++ b/src/core/event/app_event/event.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include +#include "core/layer/layer.hpp" +#include "category/event_type.hpp" + +namespace tr::core::app_event +{ + using layers_stack = std::vector; + + class event + { + public: + void set_event_callback(layer* l) + { + l_stack.push_back(l); + }; + + void execute(event_type type, std::any value) + { + tbb::parallel_for(tbb::blocked_range(0, l_stack.size()), [&](tbb::blocked_range r) + { + for (int i = r.begin(); i < r.end(); ++i) + l_stack[i]->on_event(type, value); + }); + } + + void print_size(); + + private: + layers_stack l_stack; + }; +} diff --git a/src/core/event/event_classificator.hpp b/src/core/event/event_classificator.hpp new file mode 100644 index 0000000..77dafce --- /dev/null +++ b/src/core/event/event_classificator.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include "core/utils/include.hpp" + +namespace tr::core::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"; } +} diff --git a/src/core/event/system_event/category/key_event.hpp b/src/core/event/system_event/category/key_event.hpp new file mode 100644 index 0000000..c45e0ad --- /dev/null +++ b/src/core/event/system_event/category/key_event.hpp @@ -0,0 +1,38 @@ +#pragma once + +#include "utils/define.hpp" +#include "core/event/system_event/event.hpp" +#include "core/event/event_classificator.hpp" + +namespace tr::core::system_event +{ + class key_event : public event + { + protected: + key_event(int kc) : keycode { kc } {} + + public: + inline int get_keycode() const { return keycode; } + + protected: + int 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()) + }; +} diff --git a/src/core/event/system_event/category/window_event.hpp b/src/core/event/system_event/category/window_event.hpp new file mode 100644 index 0000000..9c767ec --- /dev/null +++ b/src/core/event/system_event/category/window_event.hpp @@ -0,0 +1,49 @@ +#pragma once + +#include "utils/define.hpp" +#include "core/event/system_event/event.hpp" +#include "core/event/event_classificator.hpp" + +namespace tr::core::system_event +{ + class window_resize_event : public event + { + public: + window_resize_event(int w, int h) : width { w }, height { h } {} + + public: + EVENT_CLASS_TYPE_FN(classificator::WINDOW_RESIZE()) + + public: + inline unsigned int get_width() const { return width; } + inline unsigned int get_height() const { return height; } + + private: + int width, 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) : focused { f } {} + + public: + EVENT_CLASS_TYPE_FN(classificator::WINDOW_FOCUS()) + + public: + inline int get_focused() { return focused; } + + private: + int focused; + }; +} + diff --git a/src/core/event/system_event/event.hpp b/src/core/event/system_event/event.hpp new file mode 100644 index 0000000..427872c --- /dev/null +++ b/src/core/event/system_event/event.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "utils/utils.hpp" + +namespace tr::core::system_event +{ + struct event + { + event() = default; + virtual ~event() = default; + + virtual std::string get_name() const = 0; + }; +} diff --git a/src/core/gui/gui.cpp b/src/core/gui/gui.cpp new file mode 100644 index 0000000..3cbec26 --- /dev/null +++ b/src/core/gui/gui.cpp @@ -0,0 +1,60 @@ +#include "gui.hpp" + +#include "style/style.hpp" +#include "core/application/application.hpp" + +namespace tr::core +{ + gui::gui() + { + 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()); + } +} + + diff --git a/src/core/gui/gui.hpp b/src/core/gui/gui.hpp new file mode 100644 index 0000000..756af6f --- /dev/null +++ b/src/core/gui/gui.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include "core/utils/include.hpp" + +namespace tr::core +{ + class gui + { + public: + gui(); + ~gui(); + + public: + void begin_frame(); + void end_frame(); + }; +} diff --git a/src/core/gui/style/fonts.hpp b/src/core/gui/style/fonts.hpp new file mode 100644 index 0000000..a1813b4 --- /dev/null +++ b/src/core/gui/style/fonts.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include + +#include "imgui.h" + +#include "icons.hpp" + +namespace tr::core::style::fonts +{ + enum font { TEXT_R_0, TEXT_REG_15, TEXT_REG_175, TEXT_REG_2, TEXT_BOLD_0, TEXT_BOLD_2, ICON_0, ICON_05, ICON_075, ICON_2 }; + + // HERE + // эту порнографию с путями нужно решить + inline const std::string PATH = "/mnt/develop/projects/cpp/fonmix/emuse.v.2.0.0/src/core/internal/"; + + inline void init() + { + ImGuiIO& io = ImGui::GetIO(); + float size_pixels = 16.0f; + static const ImWchar icon_ranges[] = { ICON_MIN_FK, ICON_MAX_FK, 0 }; + + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Regular.ttf")).c_str(), size_pixels, NULL, io.Fonts->GetGlyphRangesCyrillic()); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Regular.ttf")).c_str(), size_pixels * 1.5f, NULL, io.Fonts->GetGlyphRangesCyrillic()); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Regular.ttf")).c_str(), size_pixels * 1.75f, NULL, io.Fonts->GetGlyphRangesCyrillic()); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Regular.ttf")).c_str(), size_pixels * 2.0f, NULL, io.Fonts->GetGlyphRangesCyrillic()); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Bold.ttf")).c_str(), size_pixels, NULL, io.Fonts->GetGlyphRangesCyrillic()); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/Ruda/Ruda-Bold.ttf")).c_str(), size_pixels * 2.0f, NULL, io.Fonts->GetGlyphRangesCyrillic()); + + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 0.50f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 0.75f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 1.1f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 1.25f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 1.5f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 1.65f, NULL, icon_ranges); + io.Fonts->AddFontFromFileTTF((PATH + std::string("/fonts/forkawesome-webfont.ttf")).c_str(), size_pixels * 2.0f, NULL, icon_ranges); + }; + + inline ImFont* GetFont(font f = font::TEXT_R_0) + { + ImGuiIO& io = ImGui::GetIO(); + ImFontAtlas* atlas = io.Fonts; + return atlas->Fonts[f]; + }; +} diff --git a/src/core/gui/style/icons.hpp b/src/core/gui/style/icons.hpp new file mode 100644 index 0000000..35c5501 --- /dev/null +++ b/src/core/gui/style/icons.hpp @@ -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 tr::core::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 diff --git a/src/core/gui/style/style.hpp b/src/core/gui/style/style.hpp new file mode 100644 index 0000000..bc41e7b --- /dev/null +++ b/src/core/gui/style/style.hpp @@ -0,0 +1,82 @@ +#pragma once + +#include "imgui.h" + +#include "icons.hpp" +#include "fonts.hpp" + +namespace tr::core::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(); + }; +}; diff --git a/src/core/layer/layer.hpp b/src/core/layer/layer.hpp new file mode 100644 index 0000000..58df856 --- /dev/null +++ b/src/core/layer/layer.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include "core/utils/include.hpp" +#include "core/event/system_event/event.hpp" +#include "core/event/app_event/category/event_type.hpp" + +namespace tr::core +{ + class layer + { + using time = time::timestep; + + public: + layer(const std::string& name_) : name { name_ } {}; + 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(app_event::event_type, std::any) {}; + virtual void on_update(time) = 0; + const std::string& get_name() const { return name; }; + + protected: + std::string name; + }; +} + diff --git a/src/core/meson.build b/src/core/meson.build new file mode 100644 index 0000000..fc17d83 --- /dev/null +++ b/src/core/meson.build @@ -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( + 'core', + include_directories : inc, + sources: [headers, sources], + dependencies : deps, + cpp_args: args +) + +core_dep = declare_dependency( + include_directories: inc, + link_with: lib, +) + +deps += core_dep diff --git a/src/core/renderer/renderer.cpp b/src/core/renderer/renderer.cpp new file mode 100644 index 0000000..ec64292 --- /dev/null +++ b/src/core/renderer/renderer.cpp @@ -0,0 +1,14 @@ +#include "renderer.hpp" + +namespace tr::core +{ + 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); + } +} diff --git a/src/core/renderer/renderer.hpp b/src/core/renderer/renderer.hpp new file mode 100644 index 0000000..3bac019 --- /dev/null +++ b/src/core/renderer/renderer.hpp @@ -0,0 +1,22 @@ +#pragma once + +#include "core/utils/include.hpp" + +/* +renderer - некий объект отрисовки и разукраски всей сцены. +Т.е. в нем все компоненты, которые нужны для создания на сцене чего-либо: +шейдера, шейдерные программы, буфера вершин, вспомогательные функции установки цвета и его очистки и т.п. + +Может использоваться в разных частях программы, где нужно что-то создать и отрисовать или перекрасить и удалить. +Относимся к этому, как к набору кисточек и ластиков при помощи которых что-то делаем на экране, рисуем или стираем. +*/ + +namespace tr::core +{ + class renderer + { + public: + static void set_color(const glm::vec4&); + static void clear(); + }; +} diff --git a/src/core/renderer/texture/texture.cpp b/src/core/renderer/texture/texture.cpp new file mode 100644 index 0000000..6793373 --- /dev/null +++ b/src/core/renderer/texture/texture.cpp @@ -0,0 +1,27 @@ +#include "texture.hpp" + +namespace tr::core +{ + texture::~texture() + { + glDeleteTextures(1, &texture_id); + } + + void texture::make() + { + if (!texture_id) + { + glGenTextures(1, &texture_id); + glBindTexture(GL_TEXTURE_2D, 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::draw(ImVec2 pos, ImVec2 size) + { + // ImGui::Image(reinterpret_cast(static_cast(texture)), ImVec2(pos.x + 100, pos.y + 100)); + ImGui::GetWindowDrawList()->AddImage(reinterpret_cast(static_cast(texture_id)), pos, size); + } +} diff --git a/src/core/renderer/texture/texture.hpp b/src/core/renderer/texture/texture.hpp new file mode 100644 index 0000000..17bbf67 --- /dev/null +++ b/src/core/renderer/texture/texture.hpp @@ -0,0 +1,26 @@ +#pragma once + +#include "core/utils/include.hpp" + +namespace tr::core +{ + class texture + { + public: + texture() = default; + ~texture(); + + public: + template + void bind(Image& image) + { + 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(); + + private: + GLuint texture_id = 0; + }; +} diff --git a/src/core/utils/define.hpp b/src/core/utils/define.hpp new file mode 100644 index 0000000..b3d31a3 --- /dev/null +++ b/src/core/utils/define.hpp @@ -0,0 +1,67 @@ +#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(time, event_manager)\ + using time = core::time::timestep;\ + using event_manager = tr::core::app_event::event;\ + using app_event = tr::core::app_event::event_type;\ + using system_event = tr::core::system_event::event + + +#define BASE_WINDOW_FLAGS()\ + if (f.no_titlebar) window_flags |= ImGuiWindowFlags_NoTitleBar;\ + if (f.no_scrollbar) window_flags |= ImGuiWindowFlags_NoScrollbar;\ + if (!f.no_menu) window_flags |= ImGuiWindowFlags_MenuBar;\ + if (f.no_move) window_flags |= ImGuiWindowFlags_NoMove;\ + if (f.no_resize) window_flags |= ImGuiWindowFlags_NoResize;\ + if (f.no_collapse) window_flags |= ImGuiWindowFlags_NoCollapse;\ + if (f.no_nav) window_flags |= ImGuiWindowFlags_NoNav;\ + if (f.no_background) window_flags |= ImGuiWindowFlags_NoBackground;\ + if (f.no_bring_to_front) window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus + +#define SET_EVENT_MANAGER_IMPL()\ + void set_event_manager(event_manager* em_)\ + {\ + em = em_;\ + em->set_event_callback(this);\ + } + +#define BASE_OVERIDE_IMPL()\ + void on_attach() override;\ + void on_detach() override;\ + void gui_render() override;\ + void on_event(tr::core::system_event::event& e) override;\ + void on_event(tr::core::app_event::event_type type, std::any value) override;\ + void on_update(time t) override + +#define CONSTRUCT_IMPL(name)\ + name() : core::layer { ""#name"" } { BASE_WINDOW_FLAGS(); };\ + ~name() = default + +#define FLAGS_STRUCT_DEFINED()\ + struct flags\ + {\ + bool p_open = false;\ + bool no_titlebar = true;\ + bool no_scrollbar = true;\ + bool no_menu = true;\ + bool no_move = true;\ + bool no_resize = true;\ + bool no_collapse = true;\ + bool no_nav = false;\ + bool no_background = false;\ + bool no_bring_to_front = false;\ + bool no_docking = true;\ + } f;\ + ImGuiWindowFlags window_flags = 0 + +#define BEGIN_IMGUI_WIN() if (!ImGui::Begin(name.c_str(), &f.p_open, window_flags)) ImGui::End() +#define END_IMGUI_WIN() ImGui::End() diff --git a/src/core/utils/include.hpp b/src/core/utils/include.hpp new file mode 100644 index 0000000..97099d9 --- /dev/null +++ b/src/core/utils/include.hpp @@ -0,0 +1,40 @@ +#pragma once + +#include +#include +#include +#include +#include +#include +#include + +#define GLFW_INCLUDE_NONE +#include "GLFW/glfw3.h" +#include "glad.h" +#include "glm/glm.hpp" +#include "logger/logger.hpp" +#include "imgui.h" +#include "imgui_impl_glfw.h" +#include "imgui_impl_opengl3.h" + +#include "variable.hpp" +#include "timestap.hpp" + +template +using event_callback = std::function; + +#include "nlohmann/json.hpp" +using JSON = nlohmann::json; + +namespace tr::core::time +{ + inline timestep get_time() + { + static float frame_time = 0.0f; + float t = (float)glfwGetTime(); + timestep ts = t - frame_time; + frame_time = t; + + return ts; + } +} diff --git a/src/core/utils/timestap.hpp b/src/core/utils/timestap.hpp new file mode 100644 index 0000000..23a7f89 --- /dev/null +++ b/src/core/utils/timestap.hpp @@ -0,0 +1,22 @@ +#pragma once + +namespace tr::core::time +{ + template + 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; + }; +} + + + diff --git a/src/core/utils/variable.hpp b/src/core/utils/variable.hpp new file mode 100644 index 0000000..c395f4f --- /dev/null +++ b/src/core/utils/variable.hpp @@ -0,0 +1,10 @@ +#pragma once + +#include +#include + +namespace tr::core::utils::var +{ + inline const std::string PROJECT_NAME = "rrr.v2"; +} + diff --git a/src/core/window/graphic_context/graphic_context.cpp b/src/core/window/graphic_context/graphic_context.cpp new file mode 100644 index 0000000..d8e1756 --- /dev/null +++ b/src/core/window/graphic_context/graphic_context.cpp @@ -0,0 +1,27 @@ +#include "graphic_context.hpp" + +namespace tr::core +{ + graphic_context::graphic_context(GLFWwindow* w) : win { w } {} + + void graphic_context::init() + { + glfwMakeContextCurrent(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(win); + } +} + diff --git a/src/core/window/graphic_context/graphic_context.hpp b/src/core/window/graphic_context/graphic_context.hpp new file mode 100644 index 0000000..03a5f3b --- /dev/null +++ b/src/core/window/graphic_context/graphic_context.hpp @@ -0,0 +1,18 @@ +#pragma once + +#include "core/utils/include.hpp" + +namespace tr::core +{ + class graphic_context + { + public: + graphic_context(GLFWwindow*); + + void init(); + void swap_buffers(); + + private: + GLFWwindow* win; + }; +} diff --git a/src/core/window/window.cpp b/src/core/window/window.cpp new file mode 100644 index 0000000..ac3c2c6 --- /dev/null +++ b/src/core/window/window.cpp @@ -0,0 +1,158 @@ +#include "window.hpp" + +#include "renderer/renderer.hpp" +#include "event/system_event/category/key_event.hpp" +#include "event/system_event/category/window_event.hpp" + +namespace tr::core +{ + window::window() + { + if (!glfwInit()) + exit(EXIT_FAILURE); + + set_hint(); + set_window(); + set_context(); + set_pointer(); + set_key_callback(); + set_window_callback(); + + hack::log(": ")("Creating window", win_data.title); + hack::log(" = ")("w", win_data.width); + hack::log(" = ")("h", win_data.height); + } + + window::~window() + { + glfwDestroyWindow(win); + glfwTerminate(); + hack::warn(": ")("destroy", "window", win_data.title); + } + + 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() + { + win_data.title = utils::var::PROJECT_NAME; + + win = glfwCreateWindow( + glfwGetVideoMode(glfwGetPrimaryMonitor())->width, + glfwGetVideoMode(glfwGetPrimaryMonitor())->height, + win_data.title.c_str(), + nullptr, nullptr + ); + + if(win == NULL) + { + hack::error()("Failed to create GLFW window"); + glfwTerminate(); + exit(EXIT_FAILURE); + } + + glfwGetWindowSize(win, &win_data.width, &win_data.height); + } + + void window::set_context() + { + context = std::make_unique(win); + context->init(); + } + + void window::set_pointer() + { + glfwSetWindowUserPointer(win, &win_data); + } + + void window::set_event_callback(const event_callback& cb) + { + win_data.callback = cb; + } + + GLFWwindow* window::glfw_window() const + { + return win; + } + + int window::width() const + { + return win_data.width; + } + + int window::height() const + { + return win_data.height; + } + + void window::update() + { + glfwPollEvents(); + 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(win, [](GLFWwindow* w, int key, int scancode, int action, int mods) + { + auto data = static_cast(glfwGetWindowUserPointer(w)); + + switch (action) + { + case GLFW_PRESS: + { + system_event::key_pressed_event e { key }; + data->callback(e); + break; + } + case GLFW_RELEASE: + { + system_event::key_released_event e { key }; + data->callback(e); + break; + } + } + }); + } + + void window::set_window_callback() + { + glfwSetWindowSizeLimits(win, win_data.width, win_data.height, GLFW_DONT_CARE, GLFW_DONT_CARE); + + glfwSetWindowSizeCallback(win, [](GLFWwindow* w, int width, int height) + { + auto data = static_cast(glfwGetWindowUserPointer(w)); + data->width = width; + data->height = height; + + system_event::window_resize_event e { width, height }; + data->callback(e); + }); + + glfwSetWindowCloseCallback(win, [](GLFWwindow* w) + { + auto data = static_cast(glfwGetWindowUserPointer(w)); + system_event::window_close_event e; + data->callback(e); + }); + + glfwSetWindowFocusCallback(win, [](GLFWwindow* w, int focused) + { + auto data = static_cast(glfwGetWindowUserPointer(w)); + system_event::window_focus_event e { focused }; + data->callback(e); + }); + } +} diff --git a/src/core/window/window.hpp b/src/core/window/window.hpp new file mode 100644 index 0000000..228c0b8 --- /dev/null +++ b/src/core/window/window.hpp @@ -0,0 +1,46 @@ +#pragma once + +#include "core/utils/include.hpp" +#include "graphic_context/graphic_context.hpp" +#include "core/event/system_event/event.hpp" + +namespace tr::core +{ + class window + { + public: + window(); + ~window(); + + public: + void update(); + GLFWwindow* glfw_window() const; + void clear() const ; + int width() const; + int height() const; + void set_event_callback(const event_callback&); + void set_window_callback(); + + private: + // ни каких unique_ptr тут неполучится + // т.к. glfwCreateWindow maloc-ом выделяет память + // что не есть хорошо для умных указателей + GLFWwindow* win; + std::unique_ptr context; + + struct window_data + { + std::string title; + int width, height; + event_callback callback; + } win_data; + + private: + void set_hint(); + void set_window(); + void set_context(); + void set_pointer(); + void set_key_callback(); + }; +} + diff --git a/src/engine/buffer/buffer.hpp b/src/engine/buffer/buffer.hpp new file mode 100644 index 0000000..9700980 --- /dev/null +++ b/src/engine/buffer/buffer.hpp @@ -0,0 +1,34 @@ +#pragma once + +#include +#include +#include + +#include "content/file/file.hpp" + +// данный буфер позволяетпо ключу найти состояние history и preview +// key - это откуда ты идешь +// value - это то, что тебя там ждет. +// т.е. буфер хранит наши прошщлые похождения +// и это отображается в history +namespace tr::database +{ + struct content_hash + { + std::size_t operator()(const std::optional& f) const + { + return f ? std::filesystem::hash_value(f.value().path) : 0; + } + }; + + struct opt_path_hash + { + std::size_t operator()(const std::optional& path) const + { + return path ? std::filesystem::hash_value(path.value()) : 0; + } + }; + + inline std::unordered_map buffer; +} + diff --git a/src/engine/content/content.cpp b/src/engine/content/content.cpp new file mode 100644 index 0000000..b584632 --- /dev/null +++ b/src/engine/content/content.cpp @@ -0,0 +1,35 @@ +#include "content.hpp" + +namespace tr +{ + void content::set_pwd(std::filesystem::path p) + { + PWD = p; + } + + void content::fill() + { + nav.fill(PWD); + his.fill(PWD); + prev.fill(nav.store[PWD].at(cursor_position).path); + } + + files* content::get(TYPE_WIN type) + { + switch (type) + { + case TYPE_WIN::HISTORY: + return &his.data; + break; + case TYPE_WIN::NAVIGATION: + return &nav.store[PWD]; + break; + case TYPE_WIN::PREVIEW: + return &prev.data; + break; + default: + std::terminate(); + break; + } + } +} diff --git a/src/engine/content/content.hpp b/src/engine/content/content.hpp new file mode 100644 index 0000000..37482bc --- /dev/null +++ b/src/engine/content/content.hpp @@ -0,0 +1,42 @@ +#pragma once + +#include + +#include "navigation/navigation.hpp" +#include "history/history.hpp" +#include "preview/preview.hpp" + +namespace tr +{ + enum class TYPE_WIN + { + HISTORY, NAVIGATION, PREVIEW + }; + + using files = std::vector; + + class content + { + public: + content() = default; + ~content() = default; + + public: + void set_pwd(std::filesystem::path); + void fill(); + files* get(TYPE_WIN); + + private: + content_type::navigation nav; + content_type::history his; + content_type::preview prev; + + // текущая виртуальная дирректория расположения пользователя, + // она может отличается от его расположения в терминале по факту + std::filesystem::path PWD; + + // чтобы не устанавливалась стрелка изначально + // полезно при первом открытии окна prev + int cursor_position = 0; + }; +} diff --git a/src/engine/content/file/file.cpp b/src/engine/content/file/file.cpp new file mode 100644 index 0000000..c0a249a --- /dev/null +++ b/src/engine/content/file/file.cpp @@ -0,0 +1,39 @@ +#include "file.hpp" + +namespace tr +{ + file::file(std::filesystem::path path_, file_type type_, bool is_link_) : id { ++hack::utils::counter::id }, path { path_ }, type { type_ }, is_link { is_link_ } {} + + file::file(file&& f) : id { ++hack::utils::counter::id }, path { std::move(f.path) }, type { std::move(f.type) }, is_link { std::move(f.is_link) }, is_mark { std::move(f.is_mark) } {} + + file::file(const file& f) : id { ++hack::utils::counter::id }, path { f.path }, type { f.type }, is_link { f.is_link }, is_mark { f.is_mark } {} + + file& file::operator=(const file& other) + { + if (this == &other) return *this; + + path = other.path; + type = other.type; + is_link = other.is_link; + is_mark = other.is_mark; + id = ++hack::utils::counter::id ; + return *this; + } + + bool file::operator<(const file& other) const + { + return path.string().compare(other.path.string()) < 0; + } + + bool file::operator==(const file& f) const + { + if (this->path == f.path) + return true; + return false; + }; + + std::ostream& operator<<(std::ostream& os, const file& f) + { + return os << f.path << std::endl; + } +} diff --git a/src/engine/content/file/file.hpp b/src/engine/content/file/file.hpp new file mode 100644 index 0000000..9a77256 --- /dev/null +++ b/src/engine/content/file/file.hpp @@ -0,0 +1,120 @@ +#pragma once + +#include "utils/utils.hpp" +#include +#include +#include + +namespace tr +{ + // FILE - файл + // DIR - дирректория + // TEXT - просто выводится текст + enum class file_type + { + FILE, DIR, TEXT + }; + + // класс-тип контента + // т.е. контентом является все, что может поместиться в терминал + // и это все называется файлом. ддиректория - это файл, файл - это файл и т.п. + // просто каждая сущность имеет свой тип см. выше + class file : public hack::utils::counter + { + public: + file() = default; + file(std::filesystem::path, file_type, bool); + file(file&&); + file(const file&); + + public: + file& operator=(const file&); + bool operator<(const file&) const; + bool operator==(const file&) const; + friend std::ostream& operator<<(std::ostream&, const file&); + + public: + int id; + std::filesystem::path path; + file_type type; + bool is_link = false; + bool is_mark = false; + }; +} + +namespace tr::file_utils +{ + using files = std::vector; + + struct filesystem_convert + { + file operator()(const std::filesystem::directory_entry& entry) const + { + file_type type = file_type::FILE; + + if (std::filesystem::is_directory(entry)) + type = file_type::DIR; + + auto is_link = std::filesystem::is_symlink(entry); + + return { entry.path(), type, is_link }; + } + }; + + inline files get_files_struct(const std::filesystem::path& path) + { + files f; + + try + { + std::filesystem::directory_iterator start(path); + std::filesystem::directory_iterator end; + std::transform(start, end, std::back_inserter(f), filesystem_convert()); + } + catch(...) + { + f.push_back({ path / "no permission", file_type::TEXT, false }); + } + + return f; + } + + // не нужно тут передавать pwd, как ссылку + // т.к. один фиг копирование в content::fill произойдет из-за + // parent_path() метода, которым мы пользуемся при передачи сюда параметра + // НО пока эта информация уже устарела, т.к. много в коде изменилось + // по этому потом поэкспериментируй с запусками эстов конечно же + // т.е. передай по ссылке и посмотри на поведение + inline files fill(std::filesystem::path pwd) + { + files current_files = get_files_struct(pwd); + files tmp; + tmp.reserve(current_files.size()); + std::sort(current_files.begin(), current_files.end()); + + files tmp_files; + tmp_files.reserve(current_files.size()); + + std::copy_if(current_files.begin(), current_files.end(), std::back_inserter(tmp), [](const file& f) -> bool { + if (f.type == file_type::DIR) return true; + return false; + }); + + std::copy_if(current_files.begin(), current_files.end(), std::back_inserter(tmp_files), [](const file& f) -> bool { + if (f.type != file_type::DIR) return true; + return false; + }); + + tmp.insert(tmp.end(), tmp_files.begin(), tmp_files.end()); + + return tmp; + } + + inline bool is_hidden(const std::filesystem::path &p) + { + std::filesystem::path::string_type name = p.filename(); + if(name != ".." && name != "." && name[0] == '.') + return true; + return false; + } +} diff --git a/src/engine/content/history/history.cpp b/src/engine/content/history/history.cpp new file mode 100644 index 0000000..e5ad554 --- /dev/null +++ b/src/engine/content/history/history.cpp @@ -0,0 +1,14 @@ +#include "history.hpp" + +namespace tr::content_type +{ + void history::fill(std::filesystem::path PWD) + { + data = file_utils::fill(PWD.parent_path()); + } + + int history::size() const + { + return static_cast(data.size()); + } +} diff --git a/src/engine/content/history/history.hpp b/src/engine/content/history/history.hpp new file mode 100644 index 0000000..1051543 --- /dev/null +++ b/src/engine/content/history/history.hpp @@ -0,0 +1,19 @@ +#pragma once + +#include "engine/content/file/file.hpp" + +namespace tr::content_type +{ + using files = std::vector; + + struct history + { + history() = default; + ~history() = default; + + int size() const; + void fill(std::filesystem::path); + + files data; + }; +} diff --git a/src/engine/content/navigation/navigation.cpp b/src/engine/content/navigation/navigation.cpp new file mode 100644 index 0000000..976a9a1 --- /dev/null +++ b/src/engine/content/navigation/navigation.cpp @@ -0,0 +1,15 @@ +#include "navigation.hpp" + +namespace tr::content_type +{ + void navigation::fill(std::filesystem::path PWD) + { + if (!store.contains(PWD)) + store[PWD] = file_utils::fill(PWD); + } + + void navigation::update(std::filesystem::path PWD) + { + store[PWD] = file_utils::fill(PWD); + } +} diff --git a/src/engine/content/navigation/navigation.hpp b/src/engine/content/navigation/navigation.hpp new file mode 100644 index 0000000..5be2ff0 --- /dev/null +++ b/src/engine/content/navigation/navigation.hpp @@ -0,0 +1,21 @@ +#pragma once + +#include + +#include "engine/content/file/file.hpp" + +namespace tr::content_type +{ + using files = std::vector; + + struct navigation + { + navigation() = default; + ~navigation() = default; + + void fill(std::filesystem::path); + void update(std::filesystem::path); + + std::unordered_map store; + }; +} diff --git a/src/engine/content/preview/preview.cpp b/src/engine/content/preview/preview.cpp new file mode 100644 index 0000000..bc50bcc --- /dev/null +++ b/src/engine/content/preview/preview.cpp @@ -0,0 +1,12 @@ +#include "preview.hpp" + +namespace tr::content_type +{ + void preview::fill(std::filesystem::path PWD) + { + if (std::filesystem::is_directory(PWD)) + data = file_utils::fill(PWD); + else + data.clear(); + } +} diff --git a/src/engine/content/preview/preview.hpp b/src/engine/content/preview/preview.hpp new file mode 100644 index 0000000..e984b37 --- /dev/null +++ b/src/engine/content/preview/preview.hpp @@ -0,0 +1,17 @@ +#pragma once + +#include "engine/content/file/file.hpp" + +namespace tr::content_type +{ + using files = std::vector; + + struct preview + { + preview() = default; + ~preview() = default; + + void fill(std::filesystem::path); + files data; + }; +} diff --git a/src/engine/engine.hpp b/src/engine/engine.hpp new file mode 100644 index 0000000..129f7ea --- /dev/null +++ b/src/engine/engine.hpp @@ -0,0 +1,61 @@ +#include "core/core.hpp" + +#include "content/content.hpp" + +#include "layers/gui/browser/navigation/navigation.hpp" +#include "layers/gui/browser/history/history.hpp" +#include "layers/gui/browser/preview/preview.hpp" + +#include "sandbox/demo.hpp" + +#define NO_DEMO + +namespace tr +{ + using event_manager = tr::core::app_event::event; + + class engine : public core::application + { + public: + engine() + { + // HERE + // убрать это в релизе + cnt.set_pwd("/mnt/develop/projects/cpp/rrr/dir_for_tests"); + cnt.fill(); + }; + ~engine() = default; + + public: + template + void push_layer(Args... args) + { + (args->set_event_manager(&em), ...); + (args->set_content(&cnt), ...); + core::application::push_layer(args...); + } + + private: + event_manager em; + content cnt; + }; + + inline core::application& core::create_app() + { + static engine e; + +#if defined DEMO + e.push_layer(new sandbox::gui::demo{}); +#endif + + e.push_layer( + new tr::layers::gui::history{}, + new tr::layers::gui::navigation{}, + new tr::layers::gui::preview{} + ); + + e.attach_layers(); + + return e; + } +} diff --git a/src/engine/layers/gui/browser/history/history.cpp b/src/engine/layers/gui/browser/history/history.cpp new file mode 100644 index 0000000..856b461 --- /dev/null +++ b/src/engine/layers/gui/browser/history/history.cpp @@ -0,0 +1,48 @@ +#include "history.hpp" + +namespace tr::layers::gui +{ + void history::on_attach() + { + BASE_WINDOW_FLAGS(); + } + + void history::on_detach() + { + + } + + void history::gui_render() + { + ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y)); + ImGui::SetNextWindowSize(ImVec2(width, height)); + + BEGIN_IMGUI_WIN(); + + + END_IMGUI_WIN(); + } + + void history::on_event(system_event& e) + { + if (e.get_name() == core::system_event::classificator::WINDOW_RESIZE()) + { + height = core::application::get()->get_window()->height() - 40.f; + width = core::application::get()->get_window()->width() / 3.f; + } + } + + void history::on_event(app_event e, std::any value) + { + switch (e) { + default: + break; + } + } + + void history::on_update(time t) + { + + } +} + diff --git a/src/engine/layers/gui/browser/history/history.hpp b/src/engine/layers/gui/browser/history/history.hpp new file mode 100644 index 0000000..130b303 --- /dev/null +++ b/src/engine/layers/gui/browser/history/history.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "core/core.hpp" +#include "engine/content/content.hpp" + +namespace tr::layers::gui +{ + class history : public core::layer + { + BASE_TYPE_DEFINE(time, event_manager); + + public: + CONSTRUCT_IMPL(history); + + public: + BASE_OVERIDE_IMPL(); + + public: + SET_EVENT_MANAGER_IMPL(); + + public: + void set_content(content* c) { cnt = c; }; + + private: + FLAGS_STRUCT_DEFINED(); + + bool show = true; + event_manager* em; + content* cnt; + + float width = 0.f; + float height = 0.f; + float pos_x = 0.f; + float pos_y = 0.f; + }; +} + diff --git a/src/engine/layers/gui/browser/navigation/navigation.cpp b/src/engine/layers/gui/browser/navigation/navigation.cpp new file mode 100644 index 0000000..6b4cc88 --- /dev/null +++ b/src/engine/layers/gui/browser/navigation/navigation.cpp @@ -0,0 +1,74 @@ +#include "navigation.hpp" + +namespace tr::layers::gui +{ + void navigation::on_attach() + { + BASE_WINDOW_FLAGS(); + data = cnt->get(TYPE_WIN::NAVIGATION); + } + + void navigation::on_detach() + { + + } + + void navigation::gui_render() + { + ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y)); + ImGui::SetNextWindowSize(ImVec2(width, height)); + + BEGIN_IMGUI_WIN(); + + auto pos = ImGui::GetCursorPos(); + auto padding = -60.f; + const ImVec4 type_color = ImVec4(0.35f, 0.35f, 0.35f, 1.0f); + + for (auto& item : *data) + { + ImGui::PushID(item.id); + + char buf[32]; + sprintf(buf, "##item_%d", item.id); + + ImGui::SetCursorPos(ImVec2(pos.x, pos.y + padding)); + if (ImGui::Selectable(buf, item.id == selected, 0, ImVec2(width, 60))) + selected = item.id; + + ImGui::PushStyleColor(ImGuiCol_Text, type_color); + ImGui::TextUnformatted(item.path.filename().string().data()); + ImGui::PopStyleColor(); + + pos.y += 24.f; + + ImGui::PopID(); + } + + + END_IMGUI_WIN(); + } + + void navigation::on_event(system_event& e) + { + if (e.get_name() == core::system_event::classificator::WINDOW_RESIZE()) + { + height = core::application::get()->get_window()->height() - 40.f; + width = core::application::get()->get_window()->width() / 3.f - padding_between_window; + pos_x = core::application::get()->get_window()->width() / 3.f + padding_between_window / 2.f; + } + } + + void navigation::on_event(app_event e, std::any value) + { + switch (e) { + default: + break; + } + } + + void navigation::on_update(time t) + { + + } +} + diff --git a/src/engine/layers/gui/browser/navigation/navigation.hpp b/src/engine/layers/gui/browser/navigation/navigation.hpp new file mode 100644 index 0000000..d267af1 --- /dev/null +++ b/src/engine/layers/gui/browser/navigation/navigation.hpp @@ -0,0 +1,41 @@ +#pragma once + +#include "core/core.hpp" +#include "engine/content/content.hpp" + +namespace tr::layers::gui +{ + class navigation : public core::layer + { + BASE_TYPE_DEFINE(time, event_manager); + + public: + CONSTRUCT_IMPL(navigation); + + public: + BASE_OVERIDE_IMPL(); + + public: + SET_EVENT_MANAGER_IMPL(); + + public: + void set_content(content* c) { cnt = c; }; + + private: + FLAGS_STRUCT_DEFINED(); + + bool show = true; + event_manager* em; + content* cnt; + files* data; + + float width = 0.f; + float height = 0.f; + float pos_x = 0.f; + float pos_y = 0.f; + float padding_between_window = 2.f; + + int selected = 0; + }; +} + diff --git a/src/engine/layers/gui/browser/preview/preview.cpp b/src/engine/layers/gui/browser/preview/preview.cpp new file mode 100644 index 0000000..5f45122 --- /dev/null +++ b/src/engine/layers/gui/browser/preview/preview.cpp @@ -0,0 +1,49 @@ +#include "preview.hpp" + +namespace tr::layers::gui +{ + void preview::on_attach() + { + BASE_WINDOW_FLAGS(); + } + + void preview::on_detach() + { + + } + + void preview::gui_render() + { + ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y)); + ImGui::SetNextWindowSize(ImVec2(width, height)); + + BEGIN_IMGUI_WIN(); + + + END_IMGUI_WIN(); + } + + void preview::on_event(system_event& e) + { + if (e.get_name() == core::system_event::classificator::WINDOW_RESIZE()) + { + height = core::application::get()->get_window()->height() - 40.f; + width = core::application::get()->get_window()->width() / 3.f; + pos_x = core::application::get()->get_window()->width() - core::application::get()->get_window()->width() / 3.f; + } + } + + void preview::on_event(app_event e, std::any value) + { + switch (e) { + default: + break; + } + } + + void preview::on_update(time t) + { + + } +} + diff --git a/src/engine/layers/gui/browser/preview/preview.hpp b/src/engine/layers/gui/browser/preview/preview.hpp new file mode 100644 index 0000000..59e1973 --- /dev/null +++ b/src/engine/layers/gui/browser/preview/preview.hpp @@ -0,0 +1,37 @@ +#pragma once + +#include "core/core.hpp" +#include "engine/content/content.hpp" + +namespace tr::layers::gui +{ + class preview : public core::layer + { + BASE_TYPE_DEFINE(time, event_manager); + + public: + CONSTRUCT_IMPL(preview); + + public: + BASE_OVERIDE_IMPL(); + + public: + SET_EVENT_MANAGER_IMPL(); + + public: + void set_content(content* c) { cnt = c; }; + + private: + FLAGS_STRUCT_DEFINED(); + + bool show = true; + event_manager* em; + content* cnt; + + float width = 0.f; + float height = 0.f; + float pos_x = 0.f; + float pos_y = 0.f; + }; +} + diff --git a/src/engine/meson.build b/src/engine/meson.build new file mode 100644 index 0000000..f1064d3 --- /dev/null +++ b/src/engine/meson.build @@ -0,0 +1,39 @@ +headers = [ + 'engine.hpp', + + 'content/content.hpp', + 'content/file/file.hpp', + 'content/navigation/navigation.hpp', + 'content/history/history.hpp', + 'content/preview/preview.hpp', + + 'layers/gui/browser/history/history.hpp', + 'layers/gui/browser/navigation/navigation.hpp', + 'layers/gui/browser/preview/preview.hpp', +] +sources = [ + 'content/content.cpp', + 'content/file/file.cpp', + 'content/navigation/navigation.cpp', + 'content/history/history.cpp', + 'content/preview/preview.cpp', + + 'layers/gui/browser/history/history.cpp', + 'layers/gui/browser/navigation/navigation.cpp', + 'layers/gui/browser/preview/preview.cpp', +] + +lib = library( + 'engine', + include_directories : inc, + sources: [headers, sources], + dependencies : deps, + cpp_args: args +) + +engine_dep = declare_dependency( + include_directories: inc, + link_with: lib, +) + +deps += engine_dep diff --git a/src/engine/sandbox/demo.hpp b/src/engine/sandbox/demo.hpp new file mode 100644 index 0000000..8b4b2f6 --- /dev/null +++ b/src/engine/sandbox/demo.hpp @@ -0,0 +1,45 @@ +#pragma once + +#include "core/core.hpp" + +namespace tr::sandbox::gui +{ + class demo : public core::layer + { + using time = core::time::timestep; + using event_manager = tr::core::app_event::event; + + public: + demo() : core::layer { "sandbox ui demo" } { }; + ~demo() = default; + + public: + void on_attach() override { hack::log()(name); } + void on_detach() override { hack::log()(name); } + void gui_render() override { ImGui::ShowDemoWindow(&show); } + void on_update(time t) override + { + // tr::core::event e; + // callback(e); + }; + + void on_event(tr::core::system_event::event& e) override + { + hack::log()(e.get_name()); + } + + void on_event(tr::core::app_event::event_type type, std::any value) override + { + } + + void set_event_manager(event_manager* em_) + { + em = em_; + em->set_event_callback(this); + }; + + private: + bool show = true; + event_manager* em; + }; +} diff --git a/src/meson.build b/src/meson.build new file mode 100644 index 0000000..fbd21de --- /dev/null +++ b/src/meson.build @@ -0,0 +1,4 @@ +inc += include_directories('.') + +subdir('core') +subdir('engine') diff --git a/subprojects/glad.wrap b/subprojects/glad.wrap new file mode 100644 index 0000000..0d5b7b5 --- /dev/null +++ b/subprojects/glad.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://gitcast.ru/chatlanin/glad.git +revision = master + +[provide] +glad = glad_dep diff --git a/subprojects/glfw.wrap b/subprojects/glfw.wrap new file mode 100644 index 0000000..6c3fa9d --- /dev/null +++ b/subprojects/glfw.wrap @@ -0,0 +1,13 @@ +[wrap-file] +directory = glfw-3.3.7 +source_url = https://github.com/glfw/glfw/archive/refs/tags/3.3.7.tar.gz +source_filename = glfw-3.3.7.tar.gz +source_hash = fd21a5f65bcc0fc3c76e0f8865776e852de09ef6fbc3620e09ce96d2b2807e04 +patch_filename = glfw_3.3.7-1_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/glfw_3.3.7-1/get_patch +patch_hash = cfc19fedadd1492f1bcf4a7e7604c81398571a696f94f3d18992060caf6b7057 +wrapdb_version = 3.3.7-1 + +[provide] +glfw3 = glfw_dep + diff --git a/subprojects/glm.wrap b/subprojects/glm.wrap new file mode 100644 index 0000000..3076857 --- /dev/null +++ b/subprojects/glm.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = glm-0.9.9.8 +source_url = https://github.com/g-truc/glm/archive/0.9.9.8.tar.gz +source_filename = 0.9.9.8.tar.gz +source_hash = 7d508ab72cb5d43227a3711420f06ff99b0a0cb63ee2f93631b162bfe1fe9592 +patch_url = https://wrapdb.mesonbuild.com/v2/glm_0.9.9.8-2/get_patch +patch_filename = glm-0.9.9.8-2-wrap.zip +patch_hash = d930a1fcd3a28d84be4e92cc4c71ff59e170a1ebbd3dbfce631eba19e478d83d + +[provide] +glm = glm_dep + diff --git a/subprojects/gtest.wrap b/subprojects/gtest.wrap new file mode 100644 index 0000000..730de1a --- /dev/null +++ b/subprojects/gtest.wrap @@ -0,0 +1,15 @@ +[wrap-file] +directory = googletest-release-1.11.0 +source_url = https://github.com/google/googletest/archive/release-1.11.0.tar.gz +source_filename = gtest-1.11.0.tar.gz +source_hash = b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5 +patch_filename = gtest_1.11.0-2_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/gtest_1.11.0-2/get_patch +patch_hash = 764530d812ac161c9eab02a8cfaec67c871fcfc5548e29fd3d488070913d4e94 + +[provide] +gtest = gtest_dep +gtest_main = gtest_main_dep +gmock = gmock_dep +gmock_main = gmock_main_dep + diff --git a/subprojects/hack.wrap b/subprojects/hack.wrap new file mode 100644 index 0000000..8b65299 --- /dev/null +++ b/subprojects/hack.wrap @@ -0,0 +1,6 @@ +[wrap-git] +url = https://gitcast.ru/chatlanin/hack.git +revision = master + +[provide] +hack = hack_dep diff --git a/subprojects/imgui.wrap b/subprojects/imgui.wrap new file mode 100644 index 0000000..c60d1a4 --- /dev/null +++ b/subprojects/imgui.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = imgui-1.87 +source_url = https://github.com/ocornut/imgui/archive/refs/tags/v1.87.tar.gz +source_filename = imgui-1.87.tar.gz +source_hash = b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20 +patch_filename = imgui_1.87-4_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/imgui_1.87-4/get_patch +patch_hash = a008fc446e8c09c5a6c985ba94d4ffe04534f8c805f2805afdd0ba17ea6c73f5 +wrapdb_version = 1.87-4 + +[provide] +imgui = imgui_dep diff --git a/subprojects/nlohmann_json.wrap b/subprojects/nlohmann_json.wrap new file mode 100644 index 0000000..857277a --- /dev/null +++ b/subprojects/nlohmann_json.wrap @@ -0,0 +1,10 @@ +[wrap-file] +directory = nlohmann_json-3.10.5 +lead_directory_missing = true +source_url = https://github.com/nlohmann/json/releases/download/v3.10.5/include.zip +source_filename = nlohmann_json-3.10.5.zip +source_hash = b94997df68856753b72f0d7a3703b7d484d4745c567f3584ef97c96c25a5798e + +[provide] +nlohmann_json = nlohmann_json_dep + diff --git a/subprojects/taglib.wrap b/subprojects/taglib.wrap new file mode 100644 index 0000000..1ad6db2 --- /dev/null +++ b/subprojects/taglib.wrap @@ -0,0 +1,12 @@ +[wrap-file] +directory = taglib-1.12 +source_url = https://github.com/taglib/taglib/releases/download/v1.12/taglib-1.12.tar.gz +source_filename = taglig-1.12.tar.gz +source_hash = 7fccd07669a523b07a15bd24c8da1bbb92206cb19e9366c3692af3d79253b703 +patch_filename = taglib_1.12-3_patch.zip +patch_url = https://wrapdb.mesonbuild.com/v2/taglib_1.12-3/get_patch +patch_hash = 95cb0267afa12308aa5f559ea55dc3dd0e1190946ecb9255ecfffec9432b1069 +wrapdb_version = 1.12-3 + +[provide] +taglib = taglib_dep diff --git a/tests/meson.build b/tests/meson.build new file mode 100644 index 0000000..286efd7 --- /dev/null +++ b/tests/meson.build @@ -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 ] +# ) +# )