Skip to content

Commit 793fce0

Browse files
authored
Merge pull request #19 from Jgocunha/feature/doxygen
docs: add Doxygen API reference and fix wiki/README gaps
2 parents 041cb90 + 37f1e8f commit 793fce0

20 files changed

Lines changed: 651 additions & 81 deletions

.github/workflows/docs.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
branches: [main]
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
concurrency:
12+
group: pages
13+
cancel-in-progress: false
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
persist-credentials: false
22+
23+
- name: Install Doxygen
24+
run: sudo apt-get update && sudo apt-get install -y doxygen graphviz
25+
26+
- name: Generate docs
27+
run: doxygen Doxyfile
28+
working-directory: imgui-platform-kit
29+
30+
- name: Copy README images
31+
run: |
32+
mkdir -p imgui-platform-kit/docs/html/imgui-platform-kit/resources/images
33+
cp imgui-platform-kit/resources/images/*.png imgui-platform-kit/docs/html/imgui-platform-kit/resources/images/
34+
35+
- uses: actions/configure-pages@v5
36+
37+
- uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: imgui-platform-kit/docs/html
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
permissions:
45+
pages: write
46+
id-token: write
47+
environment:
48+
name: github-pages
49+
url: ${{ steps.deployment.outputs.page_url }}
50+
steps:
51+
- name: Deploy to GitHub Pages
52+
id: deployment
53+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
install/
88
build/
9+
10+
# Generated Doxygen output
11+
imgui-platform-kit/docs/
912
# Prerequisites
1013
*.d
1114

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
<img src="./imgui-platform-kit/resources/images/logo-bg.png" alt="logo" length="400" width="400">
2+
<img src="./imgui-platform-kit/resources/images/logo-bg.png" alt="logo" height="400" width="400">
33

44

55
imgui-platform-kit - Cross-platform toolkit for Dear ImGui.
@@ -10,6 +10,7 @@ imgui-platform-kit - Cross-platform toolkit for Dear ImGui.
1010
[![macOS](https://img.shields.io/github/actions/workflow/status/Jgocunha/imgui-platform-kit/macos.yml?branch=main&style=flat-square&logo=apple&logoColor=white&label=macOS)](https://github.com/Jgocunha/imgui-platform-kit/actions/workflows/macos.yml)
1111
[![Coverage](https://img.shields.io/codecov/c/github/Jgocunha/imgui-platform-kit?style=flat-square&logo=codecov&logoColor=white)](https://codecov.io/gh/Jgocunha/imgui-platform-kit)
1212
[![Wiki](https://img.shields.io/badge/docs-wiki-blue?style=flat-square&logo=github&logoColor=white)](https://github.com/Jgocunha/imgui-platform-kit/wiki)
13+
[![API Reference](https://img.shields.io/badge/docs-API%20reference-blue?style=flat-square&logo=doxygen&logoColor=white)](https://jgocunha.github.io/imgui-platform-kit/)
1314

1415
[![C++20](https://img.shields.io/badge/C%2B%2B-20-00599C?style=flat-square&logo=cplusplus&logoColor=white)](https://en.cppreference.com/w/cpp/20)
1516
[![CMake](https://img.shields.io/badge/CMake-3.15%2B-064F8C?style=flat-square&logo=cmake&logoColor=white)](https://cmake.org)
@@ -104,9 +105,9 @@ target_link_libraries(MyAwesomeApp PRIVATE imgui-platform-kit)
104105

105106
1. **Define Your Window Class**:
106107
```cpp
107-
#include "base_window.h"
108+
#include "user_interface_window.h"
108109

109-
class MyCustomWindow : public BaseWindow
110+
class MyCustomWindow : public imgui_kit::UserInterfaceWindow
110111
{
111112
public:
112113
MyCustomWindow();

imgui-platform-kit/Doxyfile

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# Doxyfile for imgui-platform-kit
2+
# Only settings that differ from the Doxygen defaults are listed.
3+
4+
#---------------------------------------------------------------------------
5+
# Project
6+
#---------------------------------------------------------------------------
7+
PROJECT_NAME = "imgui-platform-kit"
8+
PROJECT_NUMBER = 2.0.0
9+
PROJECT_BRIEF = "Cross-platform Dear ImGui application framework"
10+
OUTPUT_DIRECTORY = docs
11+
12+
#---------------------------------------------------------------------------
13+
# Input
14+
#---------------------------------------------------------------------------
15+
INPUT = include \
16+
../README.md
17+
RECURSIVE = YES
18+
EXCLUDE_PATTERNS = */stb_image.h
19+
USE_MDFILE_AS_MAINPAGE = ../README.md
20+
IMAGE_PATH = resources/images
21+
22+
#---------------------------------------------------------------------------
23+
# Extraction
24+
#---------------------------------------------------------------------------
25+
EXTRACT_ALL = YES
26+
EXTRACT_STATIC = YES
27+
JAVADOC_AUTOBRIEF = YES
28+
BUILTIN_STL_SUPPORT = YES
29+
30+
#---------------------------------------------------------------------------
31+
# Preprocessing
32+
# _WIN32 is predefined so that a single canonical UserInterface (the
33+
# Win32/DX12 backend) is documented; the GLFW backends expose an identical
34+
# public API. IM_FMTARGS is an ImGui format-checking macro with no
35+
# documentation value.
36+
#---------------------------------------------------------------------------
37+
ENABLE_PREPROCESSING = YES
38+
MACRO_EXPANSION = YES
39+
EXPAND_ONLY_PREDEF = YES
40+
PREDEFINED = _WIN32 \
41+
"IM_FMTARGS(x)="
42+
43+
#---------------------------------------------------------------------------
44+
# Output
45+
#---------------------------------------------------------------------------
46+
GENERATE_HTML = YES
47+
GENERATE_LATEX = NO
48+
GENERATE_TREEVIEW = YES
49+
50+
#---------------------------------------------------------------------------
51+
# Warnings
52+
#---------------------------------------------------------------------------
53+
QUIET = YES
54+
WARN_IF_UNDOCUMENTED = YES
55+
56+
#---------------------------------------------------------------------------
57+
# Diagrams (requires graphviz)
58+
#---------------------------------------------------------------------------
59+
HAVE_DOT = YES
60+
DOT_IMAGE_FORMAT = svg

imgui-platform-kit/include/colour_palette.h

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
#pragma once
22

3+
/**
4+
* @file colour_palette.h
5+
* @brief Named colour constants for use with ImGui (e.g. LogWindow::addLog()).
6+
*/
7+
38
#include "imgui.h"
49

510
namespace imgui_kit
611
{
12+
/**
13+
* @brief Named @c constexpr ImVec4 colour constants (RGBA, 0.0-1.0).
14+
*/
715
namespace colours
816
{
17+
/**
18+
* @defgroup colours_basic Basic colours
19+
* @brief Primary and secondary colours.
20+
* @{
21+
*/
922
// Basic Colors
1023
constexpr ImVec4 White = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);
1124
constexpr ImVec4 Black = ImVec4(0.00f, 0.00f, 0.00f, 1.00f);
@@ -17,7 +30,13 @@ namespace imgui_kit
1730
constexpr ImVec4 Purple = ImVec4(0.50f, 0.00f, 0.50f, 1.00f);
1831
constexpr ImVec4 Cyan = ImVec4(0.00f, 1.00f, 1.00f, 1.00f);
1932
constexpr ImVec4 Magenta = ImVec4(1.00f, 0.00f, 1.00f, 1.00f);
33+
/** @} */
2034

35+
/**
36+
* @defgroup colours_extended Extended palette
37+
* @brief Additional named colours.
38+
* @{
39+
*/
2140
// Extended Palette
2241
constexpr ImVec4 Coral = ImVec4(1.00f, 0.50f, 0.31f, 1.00f);
2342
constexpr ImVec4 Violet = ImVec4(0.93f, 0.51f, 0.93f, 1.00f);
@@ -31,21 +50,39 @@ namespace imgui_kit
3150
constexpr ImVec4 Navy = ImVec4(0.00f, 0.00f, 0.50f, 1.00f);
3251
constexpr ImVec4 Mint = ImVec4(0.74f, 1.00f, 0.98f, 1.00f);
3352
constexpr ImVec4 Peach = ImVec4(1.00f, 0.89f, 0.71f, 1.00f);
53+
/** @} */
3454

55+
/**
56+
* @defgroup colours_grayscale Grayscales
57+
* @brief Shades of grey.
58+
* @{
59+
*/
3560
// Grayscales
3661
constexpr ImVec4 DarkGray = ImVec4(0.20f, 0.20f, 0.20f, 1.00f);
3762
constexpr ImVec4 Gray = ImVec4(0.50f, 0.50f, 0.50f, 1.00f);
3863
constexpr ImVec4 LightGray = ImVec4(0.75f, 0.75f, 0.75f, 1.00f);
3964
constexpr ImVec4 Silver = ImVec4(0.75f, 0.75f, 0.80f, 1.00f);
65+
/** @} */
4066

67+
/**
68+
* @defgroup colours_pastel Pastel colours
69+
* @brief Soft, low-saturation colours.
70+
* @{
71+
*/
4172
// Pastel Colors
4273
constexpr ImVec4 PastelPink = ImVec4(1.00f, 0.82f, 0.86f, 1.00f);
4374
constexpr ImVec4 PastelGreen = ImVec4(0.47f, 0.87f, 0.47f, 1.00f);
4475
constexpr ImVec4 PastelBlue = ImVec4(0.68f, 0.85f, 0.90f, 1.00f);
4576
constexpr ImVec4 PastelYellow = ImVec4(0.99f, 0.99f, 0.59f, 1.00f);
4677
constexpr ImVec4 PastelOrange = ImVec4(1.00f, 0.70f, 0.28f, 1.00f);
4778
constexpr ImVec4 PastelViolet = ImVec4(0.80f, 0.60f, 0.80f, 1.00f);
79+
/** @} */
4880

81+
/**
82+
* @defgroup colours_dark Dark colours
83+
* @brief Darkened variants of the basic colours.
84+
* @{
85+
*/
4986
// Dark Colors
5087
constexpr ImVec4 DarkRed = ImVec4(0.55f, 0.00f, 0.00f, 1.00f);
5188
constexpr ImVec4 DarkGreen = ImVec4(0.00f, 0.39f, 0.00f, 1.00f);
@@ -55,6 +92,7 @@ namespace imgui_kit
5592
constexpr ImVec4 DarkCyan = ImVec4(0.00f, 0.55f, 0.55f, 1.00f);
5693
constexpr ImVec4 DarkMagenta = ImVec4(0.55f, 0.00f, 0.55f, 1.00f);
5794
constexpr ImVec4 DarkOrange = ImVec4(0.55f, 0.27f, 0.07f, 1.00f);
95+
/** @} */
5896
}
59-
60-
}
97+
98+
}

imgui-platform-kit/include/linux/glfw_opengl3_user_interface.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11

22
#pragma once
33

4+
/**
5+
* @file glfw_opengl3_user_interface.h
6+
* @brief Linux backend of imgui_kit::UserInterface (GLFW + OpenGL 3).
7+
*
8+
* Include the platform-independent user_interface.h instead of this header;
9+
* it selects the right backend automatically. The public API is identical to
10+
* the documented Windows variant.
11+
*/
12+
413
#if defined(__linux__)
514

615
#include "imgui.h"
@@ -45,6 +54,10 @@ namespace ImNodeEditor = ax::NodeEditor;
4554

4655
namespace imgui_kit
4756
{
57+
/**
58+
* @brief OpenGL texture holding the background image and its parameters.
59+
* Managed internally by UserInterface.
60+
*/
4861
struct GLFWbackgroundImageTexture
4962
{
5063
GLuint texture;
@@ -60,6 +73,12 @@ namespace imgui_kit
6073
{}
6174
};
6275

76+
/**
77+
* @brief Main application object (Linux GLFW + OpenGL 3 backend).
78+
*
79+
* Same public API as the documented Windows variant: initialize(),
80+
* render(), shutdown(), isShutdownRequested() and addWindow().
81+
*/
6382
class UserInterface
6483
{
6584
private:

imgui-platform-kit/include/log_window.h

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11

22
#pragma once
33

4+
/**
5+
* @file log_window.h
6+
* @brief Built-in log window with colour-coded entries, filtering and auto-scroll.
7+
*/
8+
49
#include <vector>
510
#include <string>
611
#include <cstdarg>
@@ -10,12 +15,23 @@
1015

1116
namespace imgui_kit
1217
{
18+
/// A single log line: message text and its display colour.
1319
struct LogEntry
1420
{
15-
std::string message;
16-
ImVec4 color;
21+
std::string message; ///< Text of the log line.
22+
ImVec4 color; ///< Colour used to render the line (see imgui_kit::colours).
1723
};
1824

25+
/**
26+
* @brief Built-in window that displays colour-coded log messages.
27+
*
28+
* The log storage is static and shared: call addLog() from anywhere in
29+
* the application, before or after a LogWindow instance exists. The
30+
* window provides a text filter and an auto-scroll option.
31+
*
32+
* Register it with UserInterface::addWindow<LogWindow>(), or embed the
33+
* log UI inside your own window with renderContent().
34+
*/
1935
class LogWindow final : public UserInterfaceWindow
2036
{
2137
private:
@@ -26,11 +42,28 @@ namespace imgui_kit
2642

2743
public:
2844
LogWindow();
45+
/**
46+
* @brief Appends a printf-style formatted message to the log.
47+
* @param color Colour used to render the message (see imgui_kit::colours).
48+
* @param fmt printf-style format string.
49+
* @param ... Format arguments.
50+
*/
2951
static void addLog(const ImVec4& color, const char* fmt, ...) IM_FMTARGS(2);
52+
/// Renders the log window. Called once per frame by the UserInterface.
3053
void render() override { draw(); }
54+
/// Returns true while the log window is open and being rendered.
3155
static bool isActive() { return isWindowActive; }
56+
/// Returns the number of stored log entries.
3257
static size_t getLogCount() { return logs.size(); }
58+
/// Removes all stored log entries.
3359
static void clearLogs() { logs.clear(); }
60+
/**
61+
* @brief Renders the log contents (toolbar, filter and entries) into
62+
* the current ImGui window.
63+
*
64+
* Use this to embed the log UI inside a custom window instead of
65+
* registering a standalone LogWindow.
66+
*/
3467
static void renderContent();
3568
~LogWindow() override = default;
3669
private:

imgui-platform-kit/include/macos/glfw_opengl3_user_interface.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11

22
#pragma once
33

4+
/**
5+
* @file glfw_opengl3_user_interface.h
6+
* @brief macOS backend of imgui_kit::UserInterface (GLFW + OpenGL 3).
7+
*
8+
* Include the platform-independent user_interface.h instead of this header;
9+
* it selects the right backend automatically. The public API is identical to
10+
* the documented Windows variant.
11+
*/
12+
413
#if defined(__APPLE__)
514

615
#include "imgui.h"
@@ -30,6 +39,10 @@ namespace ImNodeEditor = ax::NodeEditor;
3039

3140
namespace imgui_kit
3241
{
42+
/**
43+
* @brief OpenGL texture holding the background image and its parameters.
44+
* Managed internally by UserInterface.
45+
*/
3346
struct GLFWbackgroundImageTexture
3447
{
3548
GLuint texture;
@@ -45,6 +58,14 @@ namespace imgui_kit
4558
{}
4659
};
4760

61+
/**
62+
* @brief Main application object (macOS GLFW + OpenGL 3 backend).
63+
*
64+
* Same public API as the documented Windows variant: initialize(),
65+
* render(), shutdown(), isShutdownRequested() and addWindow().
66+
* @note Setting a window icon is a no-op on macOS (GLFW limitation);
67+
* the application icon comes from the app bundle instead.
68+
*/
4869
class UserInterface
4970
{
5071
private:

0 commit comments

Comments
 (0)