Conquer Space 0.0.0
A space themed grand strategy game set in the near future, with realistic orbital mechanics, and an emphasis on economics and politics.
cqspgui.h
Go to the documentation of this file.
1/* Conquer Space
2 * Copyright (C) 2021-2023 Conquer Space
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17#pragma once
18
19#include <utility>
20
21#include "engine/application.h"
22#include "engine/gui.h"
23
27namespace CQSPGui {
29bool DefaultButton(const char* name, const ImVec2& size = ImVec2(0, 0));
30bool SmallDefaultButton(const char* label);
31bool DefaultSelectable(const char* label, bool selected = false, ImGuiSelectableFlags flags = 0,
32 const ImVec2& size = ImVec2(0, 0));
33bool DefaultSelectable(const char* label, bool* p_selected, ImGuiSelectableFlags flags = 0,
34 const ImVec2& size = ImVec2(0, 0));
35bool DefaultCheckbox(const char* label, bool* v);
36bool ArrowButton(const char* label, ImGuiDir dir);
37bool SliderFloat(const char* label, float* v, float v_min, float v_max, const char* format = "%.3f",
38 ImGuiSliderFlags flags = 0);
39bool SliderInt(const char* label, int* v, int v_min, int v_max, const char* format = "%d", ImGuiSliderFlags flags = 0);
40bool DragFloat(const char* label, float* v, float v_speed = 1.0f, float v_min = 0.0f, float v_max = 0.0f,
41 const char* format = "%.3f", ImGuiSliderFlags flags = 0);
42bool DragInt(const char* label, int* v, float v_speed = 1.0f, int v_min = 0, int v_max = 0, const char* format = "%d",
43 ImGuiSliderFlags flags = 0);
44
45template <typename... Args>
46void SimpleTextTooltip(fmt::format_string<Args...> fmt, Args&&... args) {
47 if (ImGui::IsItemHovered()) {
48 ImGui::BeginTooltip();
49 ImGui::Text("%s", fmt::format(fmt, std::forward<Args>(args)...).c_str());
50 ImGui::EndTooltip();
51 }
52}
53} // namespace CQSPGui
Definition: application.h:47
Gui with sound
Definition: cqspgui.cpp:20
void SimpleTextTooltip(fmt::format_string< Args... > fmt, Args &&... args)
Definition: cqspgui.h:46
bool DefaultSelectable(const char *label, bool selected, ImGuiSelectableFlags flags, const ImVec2 &size)
Definition: cqspgui.cpp:39
void SetApplication(cqsp::engine::Application *context)
Definition: cqspgui.cpp:21
bool DragInt(const char *label, int *v, float v_speed, int v_min, int v_max, const char *format, ImGuiSliderFlags flags)
Definition: cqspgui.cpp:96
bool SmallDefaultButton(const char *label)
Definition: cqspgui.cpp:31
bool ArrowButton(const char *label, ImGuiDir dir)
Definition: cqspgui.cpp:63
bool DragFloat(const char *label, float *v, float v_speed, float v_min, float v_max, const char *format, ImGuiSliderFlags flags)
Definition: cqspgui.cpp:87
bool SliderInt(const char *label, int *v, int v_min, int v_max, const char *format, ImGuiSliderFlags flags)
Definition: cqspgui.cpp:79
bool DefaultButton(const char *name, const ImVec2 &size)
Definition: cqspgui.cpp:23
bool DefaultCheckbox(const char *label, bool *v)
Definition: cqspgui.cpp:55
bool SliderFloat(const char *label, float *v, float v_min, float v_max, const char *format, ImGuiSliderFlags flags)
Definition: cqspgui.cpp:71
@ Text
Definition: vfs.h:27