nCine::Backends::LibretroGfxDevice class

Graphics device presenting through the libretro frontend.

The frontend owns the video output, so there is no window to create or resize. With the software backend the CPU framebuffer is handed over to retro_video_refresh, with the OpenGL backend the frame is drawn straight into the framebuffer object of the frontend.

Base classes

class nCine::IGfxDevice
Represents the interface to the graphics device where everything is rendered.

Public static functions

static void FillSystemAvInfo(retro_system_av_info& info, std::int32_t width, std::int32_t height)
Fills the structure describing the video and audio output to the frontend.
static void SetTargetFps(double fps)
Sets the rate the game runs at: one retro_run advances one frame of 1/fps seconds.
static auto GetTargetFps() -> double
Returns the rate the game runs at.
static void ReannounceAvInfo()
Re-announces the AV info to the frontend with the last advertised geometry, after a timing change.
static auto InitializeGraphicsLibrary() -> bool
Initializes the OpenGL function pointers, must be called with the context current.
static void SetCurrentFramebufferCallback(retro_hw_get_current_framebuffer_t callback)
Sets the frontend callback returning the framebuffer object to render into.

Constructors, destructors, conversion operators

LibretroGfxDevice(const WindowMode& windowMode, const ContextInfo& contextInfo, const DisplayMode& displayMode)

Public functions

void beginFrame()
Repoints the engine at the current framebuffer of the frontend and resyncs the cached state.
void setSwapInterval(int interval) override
Sets the number of vertical blanks to occur before a buffer swap.
void setResolution(bool fullscreen, int width = 0, int height = 0) override
Sets the screen resolution with two integers.
void setWindowPosition(int x, int y) override
Sets the position of the application window with two integers.
void setWindowTitle(StringView windowTitle) override
Sets the application window title.
void setWindowIcon(StringView iconFilename) override
Sets the application window icon.
void setWindowSize(int width, int height) override
Sets the window size with two integers.
auto currentVideoMode(unsigned int monitorIndex) const -> const VideoMode& override
Returns the current video mode for the specified monitor.

Protected functions

void setResolutionInternal(int width, int height) override

Private functions

void update() override
Updates the screen by swapping the back and front buffers.

Function documentation

void nCine::Backends::LibretroGfxDevice::setSwapInterval(int interval) override

Sets the number of vertical blanks to occur before a buffer swap.

An interval of -1 will enable adaptive v-sync if available.

void nCine::Backends::LibretroGfxDevice::setWindowSize(int width, int height) override

Sets the window size with two integers.