Skip to content

Commit

Permalink
Remove TOC from README & fixup doxy comments for HTML docs
Browse files Browse the repository at this point in the history
  • Loading branch information
cppimmo committed Dec 19, 2023
1 parent 20e2bd4 commit aaa496d
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 60 deletions.
6 changes: 3 additions & 3 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PROJECT_BRIEF = Source only library for using ImGui with the DCS: World
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.

PROJECT_LOGO =
PROJECT_LOGO = FmGuiIcon.png

# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
Expand Down Expand Up @@ -917,7 +917,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.

INPUT = README.md Source/
INPUT = README.md Source/ Examples/

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down Expand Up @@ -1070,7 +1070,7 @@ EXAMPLE_RECURSIVE = NO
# that contain images that are to be included in the documentation (see the
# \image command).

IMAGE_PATH =
IMAGE_PATH = Images/

# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
Expand Down
Binary file added FmGuiIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 15 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
# DCS EFM ImGui (FmGui)

![In-game image.](Images/InDCS.jpg)
![ImGui demo working in-game with an EFM aircraft plugin.](Images/InDCS.jpg)

FmGui is a source only library that implements the Dear ImGui library, and optionally the ImPlot extension, for use with the DCS: World EFM API. Its purpose is to greatly ease the development process of the user's EFM. You can view the Doxygen documentation for the project at: [https://cppimmo.github.io/DCS-EFM-ImGui/](https://cppimmo.github.io/DCS-EFM-ImGui/).

# Table of Contents
**Project Links**

- [1 Setup](#building)
- [1.1 Setting Up ImGui](#imgui)
- [1.2 Setting Up ImPlot](#implot)
- [1.3 Setting Up MinHook](#minhook)
- [2 Examples](#examples)
- [3 Note](#note)
- [4 License](#license)
- [GitHub Repository](https://github.com/cppimmo/DCS-EFM-ImGui/)
- [HTML Documentation](https://cppimmo.github.io/DCS-EFM-ImGui/)

## 1 Building: <a name="building"></a>
# Building
To use the [Source/FmGui.hpp](Source/FmGui.hpp) and [Source/FmGui.cpp](Source/FmGui.cpp) source files, they must be included in the user's EFM Visual Studio or CMake project. In Visual Studio you can add existing file(s) as seen below.

![Add Existing](Images/AddExisting.jpg)
![Adding existing files.](Images/AddExisting.jpg)

The user will need to have the "Desktop development with C++" and "Game development with C++" Visual Studio workloads installed to successful build these source files. The "Game development with C++" workload is needed, because it contains the DirectX SDK. The process for installing these workloads can be seen below.

![Modify Workloads](Images/Modify.jpg)
![Modifying Visual Studio workloads.](Images/Modify.jpg)

![Add Workloads](Images/Workloads.jpg)
![Adding Visual Studio workloads.](Images/Workloads.jpg)

The FmGui source files use the ImGui, ImPlot (optionally), and MinHook libraries. The required libraries are supplied as submodules of this repository, but you may also wish to retrieve them directly. You may find ImGui v1.87 [here](https://github.com/ocornut/imgui/releases/tag/v1.87) ImPlot v0.13 [here](t/implot/releases/tag/v0.13), and you can find MinHook v1.3.3 [here](https://github.com/TsudaKageyu/minhook/releases/tag/v1.3.3).

### 1.1 Setting Up ImGui <a name="imgui"></a>
## Setting Up ImGui

Including ImGui in your EFM project is really simple. FmGui assumes that you store the ImGui source files in their original directory and add them to your project's include path. For example, consider the following folder structure below.

Expand Down Expand Up @@ -65,13 +60,13 @@ Since ImGui is distributed in source form you must add the .cpp files to your pr

You could also add the header files to your include path, but FmGui assumes the ImGui headers can be found in the current working directory.

### 1.2 Setting Up ImPlot <a name="implot"></a>
## Setting Up ImPlot

ImPlot is an extension for ImGui that adds many useful new widgets such as plots, graphs, charts, and more.

**Note:** The ImPlot dependency is optional. In order to use ImPlot you need to add the `FMGUI_ENABLE_IMPLOT` preprocessor definition to your build process as shown in the image below.

![ImPlot Processor Definition](Images/Preprocessor.jpg)
![Setting ImPlot preprocessor definition.](Images/Preprocessor.jpg)

An ImPlot directory setup might look like this:

Expand All @@ -96,7 +91,7 @@ In Visual Studio select your project in the Solution Explorer and then add the f

Much like ImGui, ImPlot is distributed in the source form so you need to add the *.cpp* files to your project in the same manner. You can press Shift + Alt + A and select *implot.cpp*, *implot_demo.cpp* (not optional), and *implot_items.cpp*.

### 1.3 Setting Up MinHook <a name="minhook"></a>
## Setting Up MinHook

As for the MinHook v1.3.3 release, assume the same project directory structure.

Expand Down Expand Up @@ -124,23 +119,23 @@ Select *Configuration Properties -> Linker -> General -> Additional Libraries Di

In the MinHook/lib/ directory of the FmGui release archive, you will see several different static libraries. Choose the static libraries with the appropriate architecture and platform toolset for your project. Add these to your different configurations in *Configuration Properties -> Linker -> Input -> Additional Dependencies*.

## 2. Examples: <a name="examples"></a>
# Examples

Checkout the Examples directory for code samples on this library's usage.

See [Examples/Fm.cpp](Examples/Fm.cpp)

For a library reference simply view the FmGui.hpp header file and its commented functions.

## 3. Note: <a name="note"></a>
# Note

Please **do not** use these source files maliciously. This code is meant to aide the user in developing an EFM with the powerful ImGui widgets library.

These source files were built and tested using Visual Studio Community 2022, Windows 10 SDK Version 10.0.19041.0, the C++20 Standard, the MinHook library v1.3.3, the DirectX SDK Version 1792, and the ImGui library version 1.87.

The minimum C++ ISO Standard requirement for these files is C++11.

## 4. License: <a name="license"></a>
# License

This project is licensed under the permissive BSD 2-Clause License. For more details view [LICENSE.txt](LICENSE.txt). The licenses used by ImGui, ImPlot, and MinHook are included in the release archives of FmGui alongside necessary source files and binaries.

81 changes: 44 additions & 37 deletions Source/FmGui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@
#include <type_traits>
#include <string>
#include <vector>

/**
* Adjust ImGui & ImPlot header names as needed.
* Adjust ImGui & ImPlot header names & paths as needed.
*/
#include <imgui.h>
/**
Expand Down Expand Up @@ -77,27 +76,27 @@ namespace FmGui
{
/**
* Enumeration that can be set to the three default styles provided by ImGui
* in the form Style::kCLASSIC, Style::kDARK, & Style::kLIGHT.
* Default value: Style::kDARK
* in the form `Style::kCLASSIC`, `Style::kDARK`, & `Style::kLIGHT`.
* Default value: `Style::kDARK`
*/
Style style = Style::kDARK;
/**
* The configuration flags passed to the ImGui context. See ImGui
* documentation for ImGuiConfigFlags.
* Default value: ImGuiConfigFlags_NavNoCaptureKeyboard
* documentation for `ImGuiConfigFlags`.
* Default value: `ImGuiConfigFlags_NavNoCaptureKeyboard`
*/
ImGuiConfigFlags configFlags = ImGuiConfigFlags_NavNoCaptureKeyboard;
/**
* Full path and filename of the auto generated ImGui .ini configuration file.
* This can be a full or relative path. See Examples/Fm.cpp for more info.
* Setting this string to empty results in no configuration file.
* Default value: "imgui.ini"
* Default value: `"imgui.ini"`
*/
std::string iniFileName = "imgui.ini";
/*
/**
* The rate in seconds at which the .ini configuration file is updated.
* Only applicable when the ImGui .ini is enabled.
* Default value: 5.0f
* Default value: `5.0f`
*/
float iniSavingRate = 5.0f;
};
Expand Down Expand Up @@ -129,30 +128,36 @@ namespace FmGui
/**
* Set pointer to function that uses the ImGui immediate mode widgets.
* See RoutinePtr for a specification.
*
* Example:
* void FmGuiRoutine(void)
* {
* ImGui::ShowDemoWindow();
* }
* Elsewhere perform a call to SetRoutinePtr(FmGuiRoutine);
*
* void FmGuiRoutine(void)
* {
* ImGui::ShowDemoWindow();
* }
*
* Elsewhere perform a call to `SetRoutinePtr(FmGuiRoutine);`.
*/
void SetRoutinePtr(RoutinePtr pRoutine);
/**
* Set pointer to optional function that handles Win32 WndProc input.
* See InputRoutinePtr for a specification.
* See `InputRoutinePtr` for a specification.
*
* Example:
* void FmGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
* {
* // Toggle widgets on Alt + W keypress.
* static bool bWidgetsEnabled = true;
* if (uMsg == WM_KEYDOWN) {
* if (wParam == 'W' && (GetAsyncKeyState(VK_MENU) & 0x8000)) {
* bWidgetsEnabled = !bWidgetsEnabled;
* FmGui::ChangeWidgetVisibility(bWidgetsEnabled);
* }
* }
* }
* Elsewhere perform a call to SetInputRoutinePtr(FmGuiInputRoutine);
*
* void FmGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
* {
* // Toggle widgets on Alt + W keypress.
* static bool bWidgetsEnabled = true;
* if (uMsg == WM_KEYDOWN) {
* if (wParam == 'W' && (GetAsyncKeyState(VK_MENU) & 0x8000)) {
* bWidgetsEnabled = !bWidgetsEnabled;
* FmGui::ChangeWidgetVisibility(bWidgetsEnabled);
* }
* }
* }
*
* Elsewhere perform a call to `SetInputRoutinePtr(FmGuiInputRoutine);`.
*
* Supplementary reading:
* https://docs.microsoft.com/en-us/windows/win32/inputdev/using-keyboard-input
Expand All @@ -163,21 +168,23 @@ namespace FmGui
/**
* Set all widget visibility and return previous value.
*
* @param bEnabled - .
* @retval - .
* @param bEnabled - Visible when true.
* @retval - Previous visibility state.
*/
bool SetWidgetVisibility(bool bEnabled);
/**
* Start FmGui and ImGui.
*
* You can supply an optional configuration using an Config object.
*
* Example:
* Config config;
* config.style = Style::kDARK;
* if (!FmGui::StartupHook(config)) {
* // FAILED!
* }
*
*
* Config config;
* config.style = Style::kDARK;
* if (!FmGui::StartupHook(config)) {
* // FAILED!
* }
*
* @param config - The FmGui::Config structure; default config if argument is not passed.
* @retval - True on success; false on failure.
*/
Expand Down Expand Up @@ -212,10 +219,10 @@ namespace FmGui
*/
std::string DebugLayerMessageDump(void);
/**
* Shutdown the FmGui and ImGui.
* Shutdown FmGui and ImGui.
* @retval - True on success; false on failure.
*/
bool ShutdownHook(void);
} // End namespace (FmGui)

#endif /* !FMGUI_FMGUI_HPP_ */
#endif /* !FMGUI_FMGUI_HPP */

0 comments on commit aaa496d

Please sign in to comment.