Skip to content

Commit

Permalink
Prepare for initial release
Browse files Browse the repository at this point in the history
  • Loading branch information
cppimmo committed Jun 21, 2022
1 parent 743ad2c commit 2e1e35e
Show file tree
Hide file tree
Showing 9 changed files with 1,113 additions and 17 deletions.
Empty file removed Examples/.placeholder
Empty file.
73 changes: 73 additions & 0 deletions Examples/Fm.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@

// Some code above...
// Include FmGui.hpp
#include "FmGui.hpp"
// Include imgui.h
#include <imgui/imgui.h>

// Some code...

// The user's ImGuiRoutine function:
void
FMImGuiRoutine(void)
{
/*
* Set up your ImGui widgets here. Refer to the ImGui documentation and
* examples for creating widgets.
*/
ImGui::ShowDemoWindow();
// ImGui::ShowAboutWindow();
// ImGui::ShowUserGuide();
ImGui::Begin("Hello, world!");
ImGui::Text("Here, have some text.");
ImGui::End();
}

// The user's ImGuiInputRoutine function:
void
FMImGuiInputRoutine(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
/*
* Handle input. See the links below for Win32 input handling.
*
*/
if (uMsg == WM_KEYDOWN) {
if (wParam == 'W') {
std::printf("W key pressed!\n");
}
}
}


// Some code...

void
ed_fm_set_plugin_data_install_path(const char *path)
{
// Start the FmGui and associated hook.
if (!FmGui::StartupHook()) {
std::fprintf(stderr, "FmGui::StartupHook failed!\n");
}
else {
// Print the addresses of the D3D11 context.
std::printf("%s", FmGui::AddressDump().c_str());
// Set the pointers to your ImGui and ImGui Input routines.
FmGui::SetImGuiRoutinePtr(FMImGuiRoutine);
FmGui::SetImGuiInputRoutinePtr(FMImGuiInputRoutine);
// Set the widget visibility to ON.
FmGui::SetWidgetVisibility(true);
}
}

// Some code...

void
ed_fm_release(void)
{
// Finally close the FmGui and associated hook.
if (!FmGui::ShutdownHook()) {
std::fprintf(stderr, "FmGui::ShutdownHook failed...\n");
}
}

// Some code...
Binary file added Images/AddExisting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/InDCS.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Modify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/Workloads.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
134 changes: 117 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,125 @@
# DCS EFM ImGui
# DCS EFM ImGui (FmGui)

## Building:
To use the D3DHook.h and D3DHook.cpp source files, they included in the user's
EFM Visual Studio or CMake project. The user will need to have the
![In-game image.](Images/InDCS.png)

FmGui is a project that implements the Dear ImGui library in the DCS: World EFM
API. Its purpose is to greatly ease the development process of the user's EFM.

# Table of Contents

1. [Building](#building)
2. [Examples](#examples)
3. [Configuration](#config)
4. [Note](#note)
5. [License](#license)

## 1. Building: <a name="building"></a>
To use the FmGui.hpp and 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.png)

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.
workloads installed to successful build these source files. The process for
installing these workloads can be seen below.

![Modify Workloads](Images/Modify.png)

![Add Workloads](Images/Workloads.png)

The source files use the ImGui and MinHook libraries.

## Examples:
Below is a simple example of the D3DHook's usage:
```C++
You may find ImGui version 1.87
[here](https://github.com/ocornut/imgui/releases/tag/v1.87), and you can find
MinHook v1.3.3
[here](https://github.com/TsudaKageyu/minhook/releases/tag/v1.3.3).

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

- EFM
- lib
- imgui-1.87
- imgui
- imconfig.h
- imgui.cpp
- imgui.h
- imgui_demo.cpp
- imgui_draw.cpp
- imgui_impl_dx11.cpp
- imgui_impl_dx11.h
- imgui_impl_win32.cpp
- imgui_impl_win32.h
- imgui_interal.h
- imgui_tables.cpp
- imgui_widgets.cpp
- imstb_rectpack.h
- imstb_textedit.h
- imstb_truetype.h
- MY_EFM_PROJECT
- FmGui.hpp
- FmGui.cpp
- .vcxproj in this directory.

In Visual Studio select your project in the Solution Explorer and then add the
following entry to *Configuration Properties -> C/C++ -> General -> Additional
Include Directories*: $(ProjectDir)..\lib\imgui-1.87\

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

- EFM
- lib
- MinHook_133_bin
- bin
- MinHook.x64.lib
- include
- MY_EFM_PROJECT
- FmGui.hpp
- FmGui.cpp
- .vcxproj in this directory.

To add the include directory and link statically for MinHook you can use the
following instructions:

In Visual Studio select your project in the Solution Explorer and then add the
following entry to *Configuration Properties -> C/C++ -> General -> Additional
Include Directories*: $(ProjectDir)..\lib\MinHook_133_bin\include\

Select *Configuration Properties -> Linker -> General -> Additional Libraries
Directories* and add $(ProjectDir)/../lib/MinHook_133_bin/bin/

Select *Configuration Properties -> Linker -> Input -> Additional Dependencies*
and add MinHook.x64.lib

Phew, I think that's everything.

## 2. Examples: <a name="examples"></a>
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. Configuration: <a name="config"></a>

Currently there are no real configuration options available, but those will be
added in the future.

## 4. Note: <a name="note"></a>
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.

```
More in-depth examples can be found in the Examples/ directory of this
repository.
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 _____, and the ImGui library version 1.87.

## 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.
## 5. License: <a name="license"></a>

These source files were builded and tested using Visual Studio Community 2022,
Windows 10 SDK Version _____, the C++20 Standard, the MinHook library version
_____, the DirectX SDK Version _____, and the ImGui library version _____.
This project is licensed under the permissive BSD 2-Clause License. For more
details view [LICENSE.txt](LICENSE.txt)
Loading

0 comments on commit 2e1e35e

Please sign in to comment.