The hidden-texture list stayed active in a game; a game texture made at the address of a freed menu picture was skipped (rendering glitches in-game). Hiding now applies only while the main menu's frame or the in-game options draw over the menu background. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
57 lines
2.6 KiB
C++
57 lines
2.6 KiB
C++
#pragma once
|
|
|
|
namespace mods::hud {
|
|
|
|
// Installs the Direct3D device hooks the HUD layout needs (once per device).
|
|
void OnDevice(void* device);
|
|
|
|
// Horizontal offset of the moved window whose render or event method runs on
|
|
// the current thread (0 outside): polled mouse positions are reduced by it.
|
|
int CursorOffsetX();
|
|
|
|
// Horizontal offset the current thread's UI drawing is shifted by (the
|
|
// outermost hooked window's; 0 outside).
|
|
int DrawOffsetX();
|
|
|
|
// The mouse cursor object as the current thread should see it: inside a moved
|
|
// window, a private copy with x shifted by CursorOffsetX().
|
|
void* CursorFor(void* cursor);
|
|
|
|
// Tooltips that are dialogs of their own (e.g. quest dialogs: they became
|
|
// visible while no moved window was under the cursor) and are visible now.
|
|
int VisibleDialogTooltips(void** out, int max);
|
|
|
|
// For mods that hook a centred window themselves: run body(context) as the
|
|
// HUD layer runs the window's render method (drawing shifted, the cursor seen
|
|
// shifted) or event handler (mouse position shifted by the window's offset).
|
|
int RenderCentred(void* window, int (*body)(void* context), void* context);
|
|
int HandleCentred(void* event, int (*body)(void* context), void* context);
|
|
// RenderCentred for full-screen windows: the menu screens' background beside
|
|
// the 1024 frame, drawn with a viewport on it (as the options in a game).
|
|
int RenderFramed(void* window, void* device, int (*body)(void* context), void* context);
|
|
|
|
// 16:9 screens (mods/screen.h): laid out on a 1365x768 canvas, centred in
|
|
// the render width. RenderCanvas / HandleCanvas run body(context) with drawing,
|
|
// cursor and mouse events in canvas coordinates; CanvasOffsetX is the canvas'
|
|
// left edge in the render target.
|
|
constexpr int kCanvasWidth = 1365;
|
|
constexpr int kCanvasHeight = 768;
|
|
int CanvasOffsetX();
|
|
int RenderCanvas(void* window, int (*body)(void* context), void* context);
|
|
int HandleCanvas(void* event, int (*body)(void* context), void* context);
|
|
|
|
// The main menu (mods/screen.cpp): with `framed`, body(context) draws the
|
|
// menu's 1024x768 frame centred in the render width (shifted, with a
|
|
// viewport on it); mouse positions are then given in frame coordinates
|
|
// (MenuFrameOffsetX, applied by the borderless mod). Without, the menu draws
|
|
// unshifted (a 16:9 screen is shown).
|
|
int RenderMenuFrame(void* device, bool framed, int (*body)(void* context), void* context);
|
|
int MenuFrameOffsetX();
|
|
|
|
// Quads drawn with one of these textures (Direct3D surfaces) are left out
|
|
// inside the frames drawn over the menu background (RenderMenuFrame, the
|
|
// in-game options), until the list changes (at most 64).
|
|
void SetHiddenTextures(void* const* surfaces, int count);
|
|
|
|
} // namespace mods::hud
|