Screen
Add this in your code:
#include <engine/ui/screen.h>
Description
Class to get information and to interact with the screen.
Static methods
GetWidth
Get the width of the screen in pixels.
int GetWidth()
Code sample:
int width = Screen::GetWidth();
GetHeight
Get the height of the screen in pixels.
int GetHeight()
Code sample:
int height = Screen::GetHeight();
SetFullScreen
Set if the window should be in fullscreen mode.
Only for Windows and Linux, no effect on other platforms.
Does not affect the editor window.
Parameters:
useFullScreenMode
: True to enable fullscreen, false to disable
void SetFullScreen(bool useFullScreenMode)
Code sample:
Screen::SetFullScreen(true);
SetVSync
Set if the window should use VSync (May cause graphical glitch on PSP).
Parameters:
useVSync
: True to enable VSync, false to disable
void SetVSync(bool useVSync)
Code sample:
Screen::SetVSync(true);
IsVSyncEnabled
Get if VSync is enabled.
bool IsVSyncEnabled()
Code sample:
Screen::SetVSync(true);
bool isEnabled = Screen::IsVSyncEnabled(); // Returns true
MakeScreenshot
Make a screenshot of the game (.png).
(Note: on PSP/PsVita, plugins overlays are also captured).
On RPCS3 emulator, you have to enable the "Write Color Buffers" gpu option. You may have to use OpenGL instead of vulkan if there are artifacts.
On PPSSPP emulator, you gave to enable software rendering.
Parameters:
fileName
: The name of the file to save the screenshot (without the extension)
void MakeScreenshot(const std::string& fileName)
Code sample:
Screen::MakeScreenshot("my_screenshot");