VCV Rack API v2
Loading...
Searching...
No Matches
rack::window::Window Struct Reference

OS window with OpenGL context. More...

#include <Window.hpp>

Public Member Functions

PRIVATE Window ()
 
PRIVATE ~Window ()
 
math::Vec getSize ()
 
void setSize (math::Vec size)
 
PRIVATE void run ()
 
PRIVATE void step ()
 
PRIVATE void screenshot (const std::string &screenshotPath)
 Takes a screenshot of the screen and saves it to a PNG file.
 
PRIVATE void screenshotModules (const std::string &screenshotsDir, float zoom=1.f)
 Saves a PNG image of all modules to screenshotsDir/<plugin slug>/<module slug>.png.
 
void close ()
 Request Window to be closed after rendering the current frame.
 
void cursorLock ()
 
void cursorUnlock ()
 
bool isCursorLocked ()
 
int getMods ()
 Gets the current keyboard mod state Don't call this from a Key event.
 
void setFullScreen (bool fullScreen)
 
bool isFullScreen ()
 
double getMonitorRefreshRate ()
 Returns the primary monitor's refresh rate in Hz.
 
double getFrameTime ()
 Returns the timestamp of the beginning of the current frame render process.
 
double getLastFrameDuration ()
 Returns the total time in seconds spent rendering the last frame.
 
double getFrameDurationRemaining ()
 Returns the current time remaining in seconds until the frame deadline, according to the frame rate limit.
 
std::shared_ptr< FontloadFont (const std::string &filename)
 Loads and caches a Font from a file path.
 
std::shared_ptr< ImageloadImage (const std::string &filename)
 Loads and caches an Image from a file path.
 
std::shared_ptr< SvgloadSvg (const std::string &filename)
 Loads and caches an Svg from a file path.
 
PRIVATE bool & fbDirtyOnSubpixelChange ()
 
PRIVATE int & fbCount ()
 

Public Attributes

Internal * internal
 
GLFWwindow * win = NULL
 
NVGcontext * vg = NULL
 
NVGcontext * fbVg = NULL
 
float pixelRatio = 1.f
 UI scaling ratio.
 
float windowRatio = 1.f
 Ratio between the framebuffer size and the window size reported by the OS.
 
std::shared_ptr< FontuiFont
 

Detailed Description

OS window with OpenGL context.

Constructor & Destructor Documentation

◆ Window()

PRIVATE rack::window::Window::Window ( )

◆ ~Window()

PRIVATE rack::window::Window::~Window ( )

Member Function Documentation

◆ getSize()

math::Vec rack::window::Window::getSize ( )

◆ setSize()

void rack::window::Window::setSize ( math::Vec  size)

◆ run()

PRIVATE void rack::window::Window::run ( )

◆ step()

PRIVATE void rack::window::Window::step ( )

◆ screenshot()

PRIVATE void rack::window::Window::screenshot ( const std::string &  screenshotPath)

Takes a screenshot of the screen and saves it to a PNG file.

◆ screenshotModules()

PRIVATE void rack::window::Window::screenshotModules ( const std::string &  screenshotsDir,
float  zoom = 1.f 
)

Saves a PNG image of all modules to screenshotsDir/<plugin slug>/<module slug>.png.

Skips screenshot if the file already exists.

◆ close()

void rack::window::Window::close ( )

Request Window to be closed after rendering the current frame.

◆ cursorLock()

void rack::window::Window::cursorLock ( )

◆ cursorUnlock()

void rack::window::Window::cursorUnlock ( )

◆ isCursorLocked()

bool rack::window::Window::isCursorLocked ( )

◆ getMods()

int rack::window::Window::getMods ( )

Gets the current keyboard mod state Don't call this from a Key event.

Simply use e.mods instead.

◆ setFullScreen()

void rack::window::Window::setFullScreen ( bool  fullScreen)

◆ isFullScreen()

bool rack::window::Window::isFullScreen ( )

◆ getMonitorRefreshRate()

double rack::window::Window::getMonitorRefreshRate ( )

Returns the primary monitor's refresh rate in Hz.

◆ getFrameTime()

double rack::window::Window::getFrameTime ( )

Returns the timestamp of the beginning of the current frame render process.

Returns NAN if no frames have begun rendering.

◆ getLastFrameDuration()

double rack::window::Window::getLastFrameDuration ( )

Returns the total time in seconds spent rendering the last frame.

Returns NAN if no frames have ended rendering.

◆ getFrameDurationRemaining()

double rack::window::Window::getFrameDurationRemaining ( )

Returns the current time remaining in seconds until the frame deadline, according to the frame rate limit.

◆ loadFont()

std::shared_ptr< Font > rack::window::Window::loadFont ( const std::string &  filename)

Loads and caches a Font from a file path.

Do not store this reference across screen frames, as the Window may have changed, invalidating the Font.

◆ loadImage()

std::shared_ptr< Image > rack::window::Window::loadImage ( const std::string &  filename)

Loads and caches an Image from a file path.

Do not store this reference across screen frames, as the Window may have changed, invalidating the Image.

◆ loadSvg()

std::shared_ptr< Svg > rack::window::Window::loadSvg ( const std::string &  filename)
inline

Loads and caches an Svg from a file path.

Alias for Svg::load().

◆ fbDirtyOnSubpixelChange()

PRIVATE bool & rack::window::Window::fbDirtyOnSubpixelChange ( )

◆ fbCount()

PRIVATE int & rack::window::Window::fbCount ( )

Member Data Documentation

◆ internal

Internal* rack::window::Window::internal

◆ win

GLFWwindow* rack::window::Window::win = NULL

◆ vg

NVGcontext* rack::window::Window::vg = NULL

◆ fbVg

NVGcontext* rack::window::Window::fbVg = NULL

◆ pixelRatio

float rack::window::Window::pixelRatio = 1.f

UI scaling ratio.

◆ windowRatio

float rack::window::Window::windowRatio = 1.f

Ratio between the framebuffer size and the window size reported by the OS.

This is not equal to pixelRatio in general.

◆ uiFont

std::shared_ptr<Font> rack::window::Window::uiFont

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