VCV Rack API v2
|
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< Font > | loadFont (const std::string &filename) |
Loads and caches a Font from a file path. | |
std::shared_ptr< Image > | loadImage (const std::string &filename) |
Loads and caches an Image from a file path. | |
std::shared_ptr< Svg > | loadSvg (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< Font > | uiFont |
OS window with OpenGL context.
PRIVATE rack::window::Window::Window | ( | ) |
PRIVATE rack::window::Window::~Window | ( | ) |
math::Vec rack::window::Window::getSize | ( | ) |
void rack::window::Window::setSize | ( | math::Vec | size | ) |
PRIVATE void rack::window::Window::run | ( | ) |
PRIVATE void rack::window::Window::step | ( | ) |
PRIVATE void rack::window::Window::screenshot | ( | const std::string & | screenshotPath | ) |
Takes a screenshot of the screen and saves it to a PNG file.
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.
void rack::window::Window::close | ( | ) |
Request Window to be closed after rendering the current frame.
void rack::window::Window::cursorLock | ( | ) |
void rack::window::Window::cursorUnlock | ( | ) |
bool rack::window::Window::isCursorLocked | ( | ) |
int rack::window::Window::getMods | ( | ) |
Gets the current keyboard mod state Don't call this from a Key event.
Simply use e.mods
instead.
void rack::window::Window::setFullScreen | ( | bool | fullScreen | ) |
bool rack::window::Window::isFullScreen | ( | ) |
double rack::window::Window::getMonitorRefreshRate | ( | ) |
Returns the primary monitor's refresh rate in Hz.
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.
double rack::window::Window::getLastFrameDuration | ( | ) |
Returns the total time in seconds spent rendering the last frame.
Returns NAN if no frames have ended rendering.
double rack::window::Window::getFrameDurationRemaining | ( | ) |
Returns the current time remaining in seconds until the frame deadline, according to the frame rate limit.
std::shared_ptr< Font > rack::window::Window::loadFont | ( | const std::string & | filename | ) |
std::shared_ptr< Image > rack::window::Window::loadImage | ( | const std::string & | filename | ) |
|
inline |
Loads and caches an Svg from a file path.
Alias for Svg::load()
.
PRIVATE bool & rack::window::Window::fbDirtyOnSubpixelChange | ( | ) |
PRIVATE int & rack::window::Window::fbCount | ( | ) |
Internal* rack::window::Window::internal |
GLFWwindow* rack::window::Window::win = NULL |
NVGcontext* rack::window::Window::vg = NULL |
NVGcontext* rack::window::Window::fbVg = NULL |
float rack::window::Window::pixelRatio = 1.f |
UI scaling ratio.
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.
std::shared_ptr<Font> rack::window::Window::uiFont |