5 #include "imgui/imgui.h"
6 #include "imgui_impl_sdl.h"
7 #include "imgui_impl_opengl3.h"
9 #include "font_material_icons.h"
10 #include "font_noto_sans_display.h"
24 ImGuiIO &io = ImGui::GetIO();
27 io.Fonts->AddFontFromMemoryCompressedTTF
29 NotoSansDisplay_compressed_data,
30 NotoSansDisplay_compressed_size,
34 const uint64_t min_mdi = ICON_MIN_MD;
35 const uint64_t max_mdi = ICON_MAX_MD;
38 const auto max_arg =
static_cast<ImWchar
>(
std::min(max_mdi, max_imgui));
39 if constexpr (max_mdi > max_imgui)
41 LOG_ERROR(
"imgui is missing {0} icons!", (max_mdi - max_imgui));
43 LOG_INFO(
"mdi range: {0}", (max_mdi - min_mdi));
44 LOG_INFO(
"imgui range: {0}", (max_imgui - min_imgui));
45 LOG_INFO(
"Supplied range: {0}", (max_arg - min_mdi));
49 static const ImWchar icons_ranges[] = {ICON_MIN_MD, max_arg, 0};
50 ImFontConfig icons_config;
51 icons_config.MergeMode =
true;
52 icons_config.PixelSnapH =
true;
53 icons_config.GlyphMinAdvanceX = 13.0f;
55 io.Fonts->AddFontFromMemoryCompressedTTF
57 MaterialIcons_compressed_data,
58 MaterialIcons_compressed_size,
67 : path_to_imgui_ini(the_path +
"imgui.ini")
73 const char* glsl_version =
"#version 150";
76 const char *glsl_version =
"#version 130";
79 ImGui::CreateContext();
81 ImGui_ImplSDL2_InitForOpenGL(the_window, context->
context);
82 ImGui_ImplOpenGL3_Init(glsl_version);
87 ImGui::GetIO().IniFilename = path_to_imgui_ini.c_str();
92 ImGui_ImplOpenGL3_Shutdown();
93 ImGui_ImplSDL2_Shutdown();
94 ImGui::DestroyContext();
100 ImGui_ImplSDL2_ProcessEvent(event);
106 ImGui_ImplOpenGL3_NewFrame();
107 ImGui_ImplSDL2_NewFrame();
117 ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData());
union SDL_Event SDL_Event
void send_events_to_imgui(const SDL_Event *event)
size2f min(const size2f lhs, const size2f rhs)
size2f max(const size2f lhs, const size2f rhs)
Library(SDL_Window *the_window, SdlOpenglContext *context, const std::string &the_path)