Mads
Multi-Agent Distributed System
Loading...
Searching...
No Matches
gui_style.hpp
Go to the documentation of this file.
1// Shared look & feel of the MADS GUI apps: ImGui style, monospace font,
2// logo texture loading, status footer and window constants.
3#pragma once
4
5#include <imgui.h>
6
7#include <filesystem>
8#include <string>
9
10namespace MadsGui {
11
12struct Texture {
13 unsigned int id = 0;
14 int width = 0;
15 int height = 0;
16};
17
18inline constexpr int kWindowWidth = 1440;
19inline constexpr int kWindowHeight = 900;
20inline constexpr ImVec4 kClearColor{0.06F, 0.06F, 0.08F, 1.0F};
21inline constexpr ImVec4 kOkColor{0.42F, 0.80F, 0.48F, 1.0F};
22inline constexpr ImVec4 kErrorColor{0.92F, 0.39F, 0.39F, 1.0F};
23inline constexpr ImGuiWindowFlags kMainWindowFlags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove |
24 ImGuiWindowFlags_NoSavedSettings |
25 ImGuiWindowFlags_NoScrollbar |
26 ImGuiWindowFlags_NoScrollWithMouse;
27
28// Sets GLFW context hints; returns the matching GLSL version string for ImGui_ImplOpenGL3_Init.
29const char *setup_gl_hints();
30void apply_style(); // StyleColorsDark + chat's rounding & colors
31ImFont *load_monospace_font(float size_pixels = 15.0F);
32Texture load_texture_from_png(const std::filesystem::path &path);
33// Loads logo_white.png, trying primary_images_dir first (skipped if empty), then the
34// source-tree share/images directory (fallback for running from the build tree).
35// Returns the first texture that loads, or an empty Texture (id == 0) if none does.
36Texture load_logo(const std::filesystem::path &primary_images_dir);
37void free_texture(Texture &texture); // glDeleteTextures if id != 0, then reset
38float status_footer_height(); // height reserved for the status footer
39void draw_status_footer(const Texture &logo, const std::string &line1, const std::string &line2);
40
41} // namespace MadsGui
Texture load_texture_from_png(const std::filesystem::path &path)
Texture load_logo(const std::filesystem::path &primary_images_dir)
float status_footer_height()
void apply_style()
constexpr ImVec4 kErrorColor
Definition gui_style.hpp:22
const char * setup_gl_hints()
constexpr ImVec4 kClearColor
Definition gui_style.hpp:20
constexpr ImVec4 kOkColor
Definition gui_style.hpp:21
constexpr ImGuiWindowFlags kMainWindowFlags
Definition gui_style.hpp:23
ImFont * load_monospace_font(float size_pixels=15.0F)
void free_texture(Texture &texture)
constexpr int kWindowWidth
Definition gui_style.hpp:18
constexpr int kWindowHeight
Definition gui_style.hpp:19
void draw_status_footer(const Texture &logo, const std::string &line1, const std::string &line2)