libultraship
Reimplementations of libultra (N64 SDK) functions for modern hardware
Loading...
Searching...
No Matches
Fast::GfxWindowBackendDXGI Class Referencefinal

DXGI/Win32 window backend used by the Fast3D renderer on Windows. More...

#include <gfx_dxgi.h>

Inheritance diagram for Fast::GfxWindowBackendDXGI:
[legend]
Collaboration diagram for Fast::GfxWindowBackendDXGI:
[legend]

Public Member Functions

 GfxWindowBackendDXGI (std::shared_ptr< Ship::Config > config=nullptr, std::shared_ptr< Ship::FileDrop > fileDrop=nullptr, std::shared_ptr< Ship::ConsoleVariable > consoleVariable=nullptr, std::shared_ptr< Fast::Fast3dGui > fast3dGui=nullptr)
 Constructs the backend with optional shared engine dependencies.
 
 ~GfxWindowBackendDXGI () override
 
HWND GetWindowHandle ()
 Returns the native Win32 window handle.
 
IDXGISwapChain1 * GetSwapChain ()
 Returns the active DXGI swap chain.
 
void CreateSwapChain (IUnknown *mDevice, std::function< void()> &&before_destroy_fn)
 Creates/recreates the swap chain and runs a pre-destroy callback when replacing it.
 
void CreateFactoryAndDevice (bool debug, int d3d_version, class GfxRenderingAPIDX11 *self, bool(*createFunc)(class GfxRenderingAPIDX11 *self, bool SoftwareRenderer))
 Creates the DXGI factory/device and invokes the renderer-side creation callback.
 
void OnKeydown (WPARAM wParam, LPARAM lParam)
 
void OnKeyup (WPARAM wParam, LPARAM lParam)
 
void OnMouseButtonDown (int btn)
 
void OnMouseButtonUp (int btn)
 
void HandleRawInputBuffered ()
 
void UpdateMousePrevPos ()
 
void ApplyMouseCaptureClip ()
 
GfxWindowBackend implementation
void Init (const char *gameName, const char *apiName, bool startFullScreen, uint32_t width, uint32_t height, int32_t posX, int32_t posY) override
 
void Close () override
 
void SetKeyboardCallbacks (bool(*onKeyDown)(int scancode), bool(*onKeyUp)(int scancode), void(*onnAllKeysUp)()) override
 
void SetMouseCallbacks (bool(*onMouseButtonDown)(int btn), bool(*onnMouseButtonUp)(int btn)) override
 
void SetFullscreenChangedCallback (void(*onnFullscreenChanged)(bool is_now_fullscreen)) override
 
void SetFullscreen (bool fullscreen) override
 
void GetActiveWindowRefreshRate (uint32_t *refreshRate) override
 
void SetCursorVisibility (bool visability) override
 
void SetMousePos (int32_t posX, int32_t posY) override
 
void GetMousePos (int32_t *x, int32_t *y) override
 
void GetMouseDelta (int32_t *x, int32_t *y) override
 
void GetMouseWheel (float *x, float *y) override
 
bool GetMouseState (uint32_t btn) override
 
void SetMouseCapture (bool capture) override
 
bool IsMouseCaptured () override
 
void GetDimensions (uint32_t *width, uint32_t *height, int32_t *posX, int32_t *posY) override
 
void SetDimensions (uint32_t width, uint32_t height, int32_t posX, int32_t posY) override
 
Ship::WindowRect GetPrimaryMonitorRect () override
 
void HandleEvents () override
 
bool IsFrameReady () override
 
void SwapBuffersBegin () override
 
void SwapBuffersEnd () override
 
double GetTime () override
 
int GetTargetFps ()
 
void SetTargetFps (int fps) override
 
void SetMaxFrameLatency (int latency) override
 
const char * GetKeyName (int scancode) override
 
bool CanDisableVsync () override
 
bool IsRunning () override
 
void Destroy () override
 
bool IsFullscreen () override
 
- Public Member Functions inherited from Fast::GfxWindowBackend
virtual ~GfxWindowBackend ()=default
 

Public Attributes

std::tuple< HMONITOR, RECT, BOOL > mMonitor
 
uint32_t current_width
 
uint32_t current_height
 
std::vector< std::tuple< HMONITOR, RECT, BOOL > > monitor_list
 
int32_t mPosX
 
int32_t mPosY
 
double mDetectedHz
 
double mDisplayPeriod
 
void(* mOnAllKeysUp )(void)
 
POINT mRawMouseDeltaBuf
 
float mMouseWheel [2]
 
bool mIsMouseCaptured
 
bool mIsMouseHovered
 
bool mInFocus
 
bool mHasMousePosition
 
std::shared_ptr< Ship::FileDropmFileDrop
 
std::shared_ptr< Ship::ConsoleVariablemConsoleVariable
 
std::shared_ptr< Fast::Fast3dGuimFast3dGui
 

Additional Inherited Members

- Protected Attributes inherited from Fast::GfxWindowBackend
void(* mOnFullscreenChanged )(bool isNowFullscreen)
 
bool(* mOnKeyDown )(int scancode)
 
bool(* mOnKeyUp )(int scancode)
 
bool(* mOnMouseButtonDown )(int btn)
 
bool(* mOnMouseButtonUp )(int btn)
 
uint32_t mTargetFps = 60
 
bool mFullScreen
 
bool mIsRunning = true
 
bool mVsyncEnabled = true
 

Detailed Description

DXGI/Win32 window backend used by the Fast3D renderer on Windows.

Implements the GfxWindowBackend interface for input, timing, swap-chain management, and fullscreen/windowed transitions.

Constructor & Destructor Documentation

◆ GfxWindowBackendDXGI()

Fast::GfxWindowBackendDXGI::GfxWindowBackendDXGI ( std::shared_ptr< Ship::Config config = nullptr,
std::shared_ptr< Ship::FileDrop fileDrop = nullptr,
std::shared_ptr< Ship::ConsoleVariable consoleVariable = nullptr,
std::shared_ptr< Fast::Fast3dGui fast3dGui = nullptr 
)

Constructs the backend with optional shared engine dependencies.

◆ ~GfxWindowBackendDXGI()

Fast::GfxWindowBackendDXGI::~GfxWindowBackendDXGI ( )
override

Member Function Documentation

◆ ApplyMouseCaptureClip()

void Fast::GfxWindowBackendDXGI::ApplyMouseCaptureClip ( )

◆ CanDisableVsync()

bool Fast::GfxWindowBackendDXGI::CanDisableVsync ( )
overridevirtual

◆ Close()

void Fast::GfxWindowBackendDXGI::Close ( )
overridevirtual

◆ CreateFactoryAndDevice()

void Fast::GfxWindowBackendDXGI::CreateFactoryAndDevice ( bool  debug,
int  d3d_version,
class GfxRenderingAPIDX11 self,
bool(*)(class GfxRenderingAPIDX11 *self, bool SoftwareRenderer)  createFunc 
)

Creates the DXGI factory/device and invokes the renderer-side creation callback.

◆ CreateSwapChain()

void Fast::GfxWindowBackendDXGI::CreateSwapChain ( IUnknown *  mDevice,
std::function< void()> &&  before_destroy_fn 
)

Creates/recreates the swap chain and runs a pre-destroy callback when replacing it.

◆ Destroy()

void Fast::GfxWindowBackendDXGI::Destroy ( )
overridevirtual

◆ GetActiveWindowRefreshRate()

void Fast::GfxWindowBackendDXGI::GetActiveWindowRefreshRate ( uint32_t *  refreshRate)
overridevirtual

◆ GetDimensions()

void Fast::GfxWindowBackendDXGI::GetDimensions ( uint32_t *  width,
uint32_t *  height,
int32_t *  posX,
int32_t *  posY 
)
overridevirtual

◆ GetKeyName()

const char * Fast::GfxWindowBackendDXGI::GetKeyName ( int  scancode)
overridevirtual

◆ GetMouseDelta()

void Fast::GfxWindowBackendDXGI::GetMouseDelta ( int32_t *  x,
int32_t *  y 
)
overridevirtual

◆ GetMousePos()

void Fast::GfxWindowBackendDXGI::GetMousePos ( int32_t *  x,
int32_t *  y 
)
overridevirtual

◆ GetMouseState()

bool Fast::GfxWindowBackendDXGI::GetMouseState ( uint32_t  btn)
overridevirtual

◆ GetMouseWheel()

void Fast::GfxWindowBackendDXGI::GetMouseWheel ( float *  x,
float *  y 
)
overridevirtual

◆ GetPrimaryMonitorRect()

Ship::WindowRect Fast::GfxWindowBackendDXGI::GetPrimaryMonitorRect ( )
overridevirtual

◆ GetSwapChain()

IDXGISwapChain1 * Fast::GfxWindowBackendDXGI::GetSwapChain ( )

Returns the active DXGI swap chain.

◆ GetTargetFps()

int Fast::GfxWindowBackendDXGI::GetTargetFps ( )
virtual

◆ GetTime()

double Fast::GfxWindowBackendDXGI::GetTime ( )
overridevirtual

◆ GetWindowHandle()

HWND Fast::GfxWindowBackendDXGI::GetWindowHandle ( )

Returns the native Win32 window handle.

◆ HandleEvents()

void Fast::GfxWindowBackendDXGI::HandleEvents ( )
overridevirtual

◆ HandleRawInputBuffered()

void Fast::GfxWindowBackendDXGI::HandleRawInputBuffered ( )

◆ Init()

void Fast::GfxWindowBackendDXGI::Init ( const char *  gameName,
const char *  apiName,
bool  startFullScreen,
uint32_t  width,
uint32_t  height,
int32_t  posX,
int32_t  posY 
)
overridevirtual

◆ IsFrameReady()

bool Fast::GfxWindowBackendDXGI::IsFrameReady ( )
overridevirtual

◆ IsFullscreen()

bool Fast::GfxWindowBackendDXGI::IsFullscreen ( )
overridevirtual

◆ IsMouseCaptured()

bool Fast::GfxWindowBackendDXGI::IsMouseCaptured ( )
overridevirtual

◆ IsRunning()

bool Fast::GfxWindowBackendDXGI::IsRunning ( )
overridevirtual

◆ OnKeydown()

void Fast::GfxWindowBackendDXGI::OnKeydown ( WPARAM  wParam,
LPARAM  lParam 
)

◆ OnKeyup()

void Fast::GfxWindowBackendDXGI::OnKeyup ( WPARAM  wParam,
LPARAM  lParam 
)

◆ OnMouseButtonDown()

void Fast::GfxWindowBackendDXGI::OnMouseButtonDown ( int  btn)

◆ OnMouseButtonUp()

void Fast::GfxWindowBackendDXGI::OnMouseButtonUp ( int  btn)

◆ SetCursorVisibility()

void Fast::GfxWindowBackendDXGI::SetCursorVisibility ( bool  visability)
overridevirtual

◆ SetDimensions()

void Fast::GfxWindowBackendDXGI::SetDimensions ( uint32_t  width,
uint32_t  height,
int32_t  posX,
int32_t  posY 
)
overridevirtual

◆ SetFullscreen()

void Fast::GfxWindowBackendDXGI::SetFullscreen ( bool  fullscreen)
overridevirtual

◆ SetFullscreenChangedCallback()

void Fast::GfxWindowBackendDXGI::SetFullscreenChangedCallback ( void(*)(bool is_now_fullscreen)  onnFullscreenChanged)
overridevirtual

◆ SetKeyboardCallbacks()

void Fast::GfxWindowBackendDXGI::SetKeyboardCallbacks ( bool(*)(int scancode)  onKeyDown,
bool(*)(int scancode)  onKeyUp,
void(*)()  onnAllKeysUp 
)
overridevirtual

◆ SetMaxFrameLatency()

void Fast::GfxWindowBackendDXGI::SetMaxFrameLatency ( int  latency)
overridevirtual

◆ SetMouseCallbacks()

void Fast::GfxWindowBackendDXGI::SetMouseCallbacks ( bool(*)(int btn)  onMouseButtonDown,
bool(*)(int btn)  onnMouseButtonUp 
)
overridevirtual

◆ SetMouseCapture()

void Fast::GfxWindowBackendDXGI::SetMouseCapture ( bool  capture)
overridevirtual

◆ SetMousePos()

void Fast::GfxWindowBackendDXGI::SetMousePos ( int32_t  posX,
int32_t  posY 
)
overridevirtual

◆ SetTargetFps()

void Fast::GfxWindowBackendDXGI::SetTargetFps ( int  fps)
overridevirtual

◆ SwapBuffersBegin()

void Fast::GfxWindowBackendDXGI::SwapBuffersBegin ( )
overridevirtual

◆ SwapBuffersEnd()

void Fast::GfxWindowBackendDXGI::SwapBuffersEnd ( )
overridevirtual

◆ UpdateMousePrevPos()

void Fast::GfxWindowBackendDXGI::UpdateMousePrevPos ( )

Member Data Documentation

◆ current_height

uint32_t Fast::GfxWindowBackendDXGI::current_height

◆ current_width

uint32_t Fast::GfxWindowBackendDXGI::current_width

◆ mConsoleVariable

std::shared_ptr<Ship::ConsoleVariable> Fast::GfxWindowBackendDXGI::mConsoleVariable

◆ mDetectedHz

double Fast::GfxWindowBackendDXGI::mDetectedHz

◆ mDisplayPeriod

double Fast::GfxWindowBackendDXGI::mDisplayPeriod

◆ mFast3dGui

std::shared_ptr<Fast::Fast3dGui> Fast::GfxWindowBackendDXGI::mFast3dGui

◆ mFileDrop

std::shared_ptr<Ship::FileDrop> Fast::GfxWindowBackendDXGI::mFileDrop

◆ mHasMousePosition

bool Fast::GfxWindowBackendDXGI::mHasMousePosition

◆ mInFocus

bool Fast::GfxWindowBackendDXGI::mInFocus

◆ mIsMouseCaptured

bool Fast::GfxWindowBackendDXGI::mIsMouseCaptured

◆ mIsMouseHovered

bool Fast::GfxWindowBackendDXGI::mIsMouseHovered

◆ mMonitor

std::tuple<HMONITOR, RECT, BOOL> Fast::GfxWindowBackendDXGI::mMonitor

◆ mMouseWheel

float Fast::GfxWindowBackendDXGI::mMouseWheel[2]

◆ mOnAllKeysUp

void(* Fast::GfxWindowBackendDXGI::mOnAllKeysUp) (void)

◆ monitor_list

std::vector<std::tuple<HMONITOR, RECT, BOOL> > Fast::GfxWindowBackendDXGI::monitor_list

◆ mPosX

int32_t Fast::GfxWindowBackendDXGI::mPosX

◆ mPosY

int32_t Fast::GfxWindowBackendDXGI::mPosY

◆ mRawMouseDeltaBuf

POINT Fast::GfxWindowBackendDXGI::mRawMouseDeltaBuf

The documentation for this class was generated from the following file: