102 Patches: Detours to the Rescue
C reference for DttR maintainers and modders.
Loading...
Searching...
No Matches
dttr_imgui.h File Reference
#include <SDL3/SDL.h>
#include <cimgui.h>
#include <cimgui_impl.h>
#include <cimgui_impl_sdlgpu3.h>
#include <stdbool.h>

Go to the source code of this file.

Data Structures

struct  DTTR_ImGuiDesktopScaleState
struct  DTTR_ImGuiDialogContext

Macros

#define DTTR_IMGUI_COLOR_LINK   ((ImVec4_c){0.33f, 0.63f, 1.0f, 1.0f})
#define DTTR_IMGUI_COLOR_STACK_FRAME_BG   ((ImVec4_c){0.10f, 0.11f, 0.12f, 1.0f})
#define DTTR_IMGUI_COLOR_BUTTON_BG   ((ImVec4_c){0.184f, 0.204f, 0.227f, 1.0f})
#define DTTR_IMGUI_COLOR_BUTTON_BG_HOVERED   ((ImVec4_c){0.235f, 0.267f, 0.298f, 1.0f})
#define DTTR_IMGUI_COLOR_BUTTON_BG_ACTIVE   ((ImVec4_c){0.145f, 0.165f, 0.188f, 1.0f})
#define DTTR_IMGUI_COLOR_BUTTON_TEXT   ((ImVec4_c){0.91f, 0.90f, 0.87f, 1.0f})
#define DTTR_IMGUI_SCALE_EPSILON   0.001f

Typedefs

typedef struct DTTR_ImGuiDesktopScaleState DTTR_ImGuiDesktopScaleState
typedef struct DTTR_ImGuiDialogContext DTTR_ImGuiDialogContext

Functions

static float DTTR_ImGui_NormalizeDesktopScale (float scale)
static float DTTR_ImGui_GetWindowDesktopScale (SDL_Window *window)
static float DTTR_ImGui_GetCurrentDesktopScale (const DTTR_ImGuiDesktopScaleState *state)
static bool DTTR_ImGui_ScaleChanged (float a, float b)
static bool DTTR_ImGui_ApplyDesktopScale (DTTR_ImGuiDesktopScaleState *state, float scale)
static bool DTTR_ImGui_ApplyWindowDesktopScale (DTTR_ImGuiDesktopScaleState *state, SDL_Window *window)
bool DTTR_ImGuiDialog_Begin (DTTR_ImGuiDialogContext *ctx, const char *title, int width, int height)
void DTTR_ImGuiDialog_End (DTTR_ImGuiDialogContext *ctx)
void DTTR_ImGuiDialog_Shutdown ()
float DTTR_ImGuiDialog_ScaledFloat (const DTTR_ImGuiDialogContext *ctx, float value)
void DTTR_ImGuiDialog_OffsetCursorY (const DTTR_ImGuiDialogContext *ctx, float amount)
bool DTTR_ImGuiDialog_RefreshScale (DTTR_ImGuiDialogContext *ctx)
void DTTR_ImGuiDialog_ProcessEvent (const DTTR_ImGuiDialogContext *ctx, const SDL_Event *event, bool *running)
void DTTR_ImGuiDialog_ProcessEvents (const DTTR_ImGuiDialogContext *ctx, bool *running)
void DTTR_ImGuiDialog_NewFrame (const DTTR_ImGuiDialogContext *ctx)
void DTTR_ImGuiDialog_Render (DTTR_ImGuiDialogContext *ctx)
bool DTTR_ImGuiDialog_BeginRoot (DTTR_ImGuiDialogContext *ctx, const char *title, ImGuiWindowFlags flags)
void DTTR_ImGuiDialog_EndRoot ()
bool DTTR_ImGuiDialog_Button (const DTTR_ImGuiDialogContext *ctx, const char *id, const char *label, ImVec2_c size)
void DTTR_ImGuiDialog_CenterNextItem (float item_width)
void DTTR_ImGuiDialog_DrawHeader (const DTTR_ImGuiDialogContext *ctx, const char *title, const char *version)
void DTTR_ImGuiDialog_DrawPaddedText (const DTTR_ImGuiDialogContext *ctx, const char *message, float padding_x, float padding_y)
void DTTR_ImGuiDialog_FitWindowToContent (DTTR_ImGuiDialogContext *ctx, int width, float padding_y)
bool DTTR_ImGui_ErrorShow (const char *title, const char *message)

Macro Definition Documentation

◆ DTTR_IMGUI_COLOR_BUTTON_BG

#define DTTR_IMGUI_COLOR_BUTTON_BG   ((ImVec4_c){0.184f, 0.204f, 0.227f, 1.0f})

Definition at line 12 of file dttr_imgui.h.

Referenced by DTTR_ImGuiDialog_Button().

◆ DTTR_IMGUI_COLOR_BUTTON_BG_ACTIVE

#define DTTR_IMGUI_COLOR_BUTTON_BG_ACTIVE   ((ImVec4_c){0.145f, 0.165f, 0.188f, 1.0f})

Definition at line 14 of file dttr_imgui.h.

Referenced by DTTR_ImGuiDialog_Button().

◆ DTTR_IMGUI_COLOR_BUTTON_BG_HOVERED

#define DTTR_IMGUI_COLOR_BUTTON_BG_HOVERED   ((ImVec4_c){0.235f, 0.267f, 0.298f, 1.0f})

Definition at line 13 of file dttr_imgui.h.

Referenced by DTTR_ImGuiDialog_Button().

◆ DTTR_IMGUI_COLOR_BUTTON_TEXT

#define DTTR_IMGUI_COLOR_BUTTON_TEXT   ((ImVec4_c){0.91f, 0.90f, 0.87f, 1.0f})

Definition at line 15 of file dttr_imgui.h.

Referenced by DTTR_ImGuiDialog_Button().

◆ DTTR_IMGUI_COLOR_LINK

#define DTTR_IMGUI_COLOR_LINK   ((ImVec4_c){0.33f, 0.63f, 1.0f, 1.0f})

Definition at line 10 of file dttr_imgui.h.

Referenced by draw_clickable_text().

◆ DTTR_IMGUI_COLOR_STACK_FRAME_BG

#define DTTR_IMGUI_COLOR_STACK_FRAME_BG   ((ImVec4_c){0.10f, 0.11f, 0.12f, 1.0f})

Definition at line 11 of file dttr_imgui.h.

Referenced by draw_copyable_stack_trace().

◆ DTTR_IMGUI_SCALE_EPSILON

#define DTTR_IMGUI_SCALE_EPSILON   0.001f

Definition at line 16 of file dttr_imgui.h.

Referenced by DTTR_ImGui_ScaleChanged().

Typedef Documentation

◆ DTTR_ImGuiDesktopScaleState

typedef struct DTTR_ImGuiDesktopScaleState DTTR_ImGuiDesktopScaleState

◆ DTTR_ImGuiDialogContext

typedef struct DTTR_ImGuiDialogContext DTTR_ImGuiDialogContext

Function Documentation

◆ DTTR_ImGui_ApplyDesktopScale()

bool DTTR_ImGui_ApplyDesktopScale ( DTTR_ImGuiDesktopScaleState * state,
float scale )
inlinestatic

◆ DTTR_ImGui_ApplyWindowDesktopScale()

bool DTTR_ImGui_ApplyWindowDesktopScale ( DTTR_ImGuiDesktopScaleState * state,
SDL_Window * window )
inlinestatic

◆ DTTR_ImGui_ErrorShow()

◆ DTTR_ImGui_GetCurrentDesktopScale()

float DTTR_ImGui_GetCurrentDesktopScale ( const DTTR_ImGuiDesktopScaleState * state)
inlinestatic

Definition at line 38 of file dttr_imgui.h.

References DTTR_ImGui_NormalizeDesktopScale(), and state.

Referenced by DTTR_ImGuiDialog_RefreshScale().

◆ DTTR_ImGui_GetWindowDesktopScale()

float DTTR_ImGui_GetWindowDesktopScale ( SDL_Window * window)
inlinestatic

Definition at line 32 of file dttr_imgui.h.

References DTTR_ImGui_NormalizeDesktopScale().

Referenced by DTTR_ImGui_ApplyWindowDesktopScale().

◆ DTTR_ImGui_NormalizeDesktopScale()

float DTTR_ImGui_NormalizeDesktopScale ( float scale)
inlinestatic

◆ DTTR_ImGui_ScaleChanged()

bool DTTR_ImGui_ScaleChanged ( float a,
float b )
inlinestatic

Definition at line 46 of file dttr_imgui.h.

References DTTR_IMGUI_SCALE_EPSILON.

Referenced by DTTR_ImGui_ApplyDesktopScale(), and DTTR_ImGuiDialog_RefreshScale().

◆ DTTR_ImGuiDialog_Begin()

bool DTTR_ImGuiDialog_Begin ( DTTR_ImGuiDialogContext * ctx,
const char * title,
int width,
int height )

◆ DTTR_ImGuiDialog_BeginRoot()

bool DTTR_ImGuiDialog_BeginRoot ( DTTR_ImGuiDialogContext * ctx,
const char * title,
ImGuiWindowFlags flags )

◆ DTTR_ImGuiDialog_Button()

bool DTTR_ImGuiDialog_Button ( const DTTR_ImGuiDialogContext * ctx,
const char * id,
const char * label,
ImVec2_c size )

◆ DTTR_ImGuiDialog_CenterNextItem()

void DTTR_ImGuiDialog_CenterNextItem ( float item_width)

Definition at line 311 of file imgui_dialog.c.

Referenced by draw_centered_text(), draw_source_buttons(), and DTTR_ImGui_ErrorShow().

◆ DTTR_ImGuiDialog_DrawHeader()

void DTTR_ImGuiDialog_DrawHeader ( const DTTR_ImGuiDialogContext * ctx,
const char * title,
const char * version )

◆ DTTR_ImGuiDialog_DrawPaddedText()

void DTTR_ImGuiDialog_DrawPaddedText ( const DTTR_ImGuiDialogContext * ctx,
const char * message,
float padding_x,
float padding_y )

◆ DTTR_ImGuiDialog_End()

◆ DTTR_ImGuiDialog_EndRoot()

void DTTR_ImGuiDialog_EndRoot ( )

◆ DTTR_ImGuiDialog_FitWindowToContent()

void DTTR_ImGuiDialog_FitWindowToContent ( DTTR_ImGuiDialogContext * ctx,
int width,
float padding_y )

◆ DTTR_ImGuiDialog_NewFrame()

void DTTR_ImGuiDialog_NewFrame ( const DTTR_ImGuiDialogContext * ctx)

◆ DTTR_ImGuiDialog_OffsetCursorY()

void DTTR_ImGuiDialog_OffsetCursorY ( const DTTR_ImGuiDialogContext * ctx,
float amount )

◆ DTTR_ImGuiDialog_ProcessEvent()

void DTTR_ImGuiDialog_ProcessEvent ( const DTTR_ImGuiDialogContext * ctx,
const SDL_Event * event,
bool * running )

Definition at line 235 of file imgui_dialog.c.

References ctx, event, and use_dialog_imgui_context().

Referenced by DTTR_ImGuiDialog_ProcessEvents(), and process_events().

◆ DTTR_ImGuiDialog_ProcessEvents()

void DTTR_ImGuiDialog_ProcessEvents ( const DTTR_ImGuiDialogContext * ctx,
bool * running )

Definition at line 255 of file imgui_dialog.c.

References ctx, DTTR_ImGuiDialog_ProcessEvent(), and event.

Referenced by DTTR_ImGui_ErrorShow(), and DTTR_LoaderUI_ChooseGameSource().

◆ DTTR_ImGuiDialog_RefreshScale()

◆ DTTR_ImGuiDialog_Render()

void DTTR_ImGuiDialog_Render ( DTTR_ImGuiDialogContext * ctx)

◆ DTTR_ImGuiDialog_ScaledFloat()

◆ DTTR_ImGuiDialog_Shutdown()

void DTTR_ImGuiDialog_Shutdown ( )

Definition at line 204 of file imgui_dialog.c.

References sdl_video_ready.

Referenced by dttr_config_main(), and dttr_launcher_main().