DCS EFM ImGui (FmGui)  v1.2
Source only library for using ImGui with the DCS: World EFM API.
FmGui Namespace Reference

FmGui types & functions. More...

Classes

struct  Config
 FmGui configuration data. More...
 
struct  Message
 FmGui message data. More...
 

Typedefs

using MessageVector = std::vector< Message >
 
using MessageCallback = std::add_pointer< void(const Message &message)>::type
 Alias for message callback.
 
using RoutinePtr = std::add_pointer< void(void)>::type
 Alias for FmGui routine function.
 
using InputRoutinePtr = std::add_pointer< void(UINT uMsg, WPARAM wParam, LPARAM lParam)>::type
 Alias for FmGui input routine function.
 

Enumerations

enum class  Style { kCLASSIC , kDARK , kLIGHT }
 ImGui display style.
 
enum class  MessageSeverity { kNOTIFICATION , kLOW , kMEDIUM , kHIGH }
 FmGui message severity levels.
 

Functions

template<typename Type >
void ReleaseCOM (Type *pInterface)
 
template<typename Type >
void ReleaseCOM (Type **ppInterface)
 
void SetRoutinePtr (RoutinePtr pRoutine)
 
void SetInputRoutinePtr (InputRoutinePtr pInputRoutine)
 
bool SetWidgetVisibility (bool bEnabled)
 
bool StartupHook (const Config &config=Config())
 
std::string AddressDump (void)
 
const MessageGetLastError (void)
 
std::vector< MessageGetEveryMessage (void)
 
void SetMessageCallback (MessageCallback pMessageCallback)
 
std::string DebugLayerMessageDump (void)
 
bool ShutdownHook (void)
 

Detailed Description

FmGui types & functions.

Function Documentation

◆ AddressDump()

std::string FmGui::AddressDump ( void  )

Retrieve D3D context memory addresses.

Return values
-Formatted string of the D3D context memory addresses.

Definition at line 142 of file FmGui.cpp.

◆ DebugLayerMessageDump()

std::string FmGui::DebugLayerMessageDump ( void  )

Return formatted string of the D3D debug layer warning/error messages.

Note: DirectX 11 does not have a callback to do this in real time. Only a vaild call if the hook was started successfully.

Return values
-An empty string to indicate and error.

Definition at line 158 of file FmGui.cpp.

◆ GetEveryMessage()

FmGui::MessageVector FmGui::GetEveryMessage ( void  )

Return a vector of error messages in order of first to last occurence.

Definition at line 658 of file FmGui.cpp.

◆ GetLastError()

const FmGui::Message & FmGui::GetLastError ( void  )

Retrieve message of the last error generated by FmGui.

Return values
-The last message.

Definition at line 653 of file FmGui.cpp.

◆ SetInputRoutinePtr()

void FmGui::SetInputRoutinePtr ( InputRoutinePtr  pInputRoutine)

Set pointer to optional function that handles Win32 WndProc input. 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);.

Supplementary reading: https://docs.microsoft.com/en-us/windows/win32/inputdev/using-keyboard-input https://docs.microsoft.com/en-us/windows/win32/inputdev/keyboard-input https://docs.microsoft.com/en-us/windows/win32/learnwin32/keyboard-input

Definition at line 132 of file FmGui.cpp.

◆ SetMessageCallback()

void FmGui::SetMessageCallback ( MessageCallback  pMessageCallback)

Sets the MessageCallback to be used by FmGui.

Parameters
pMessageCallback- The pointer to the message callback function.

Definition at line 137 of file FmGui.cpp.

◆ SetRoutinePtr()

void FmGui::SetRoutinePtr ( RoutinePtr  pRoutine)

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);.

Definition at line 127 of file FmGui.cpp.

◆ SetWidgetVisibility()

bool FmGui::SetWidgetVisibility ( bool  bEnabled)

Set all widget visibility and return previous value.

Parameters
bEnabled- Visible when true.
Return values
-Previous visibility state.

Definition at line 360 of file FmGui.cpp.

◆ ShutdownHook()

bool FmGui::ShutdownHook ( void  )

Shutdown FmGui and ImGui.

Return values
-True on success; false on failure.

Definition at line 595 of file FmGui.cpp.

◆ StartupHook()

bool FmGui::StartupHook ( const Config config = Config())

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!
}
Parameters
config- The FmGui::Config structure; default config if argument is not passed.
Return values
-True on success; false on failure.

Definition at line 376 of file FmGui.cpp.