16int SDLVisibleSurfaceBase::windowPosX = SDL_WINDOWPOS_UNDEFINED;
17int SDLVisibleSurfaceBase::windowPosY = SDL_WINDOWPOS_UNDEFINED;
24 if ((SDL_GetWindowFlags(
window.get()) & SDL_WINDOW_FULLSCREEN) == 0) {
25 SDL_GetWindowPosition(
window.get(), &windowPosX, &windowPosY);
34 if (
getDisplay().getRenderSettings().getFullScreen()) {
35 flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
39 flags |= SDL_WINDOW_ALLOW_HIGHDPI;
43 window.reset(SDL_CreateWindow(
45 windowPosX, windowPosY,
49 std::string err = SDL_GetError();
56 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,
"1");
59 if constexpr (OPENMSX_SET_WINDOW_ICON) {
67 "Falling back to built in 32x32 icon, because failed to load icon: ",
70 iconSurf.
reset(SDL_CreateRGBSurfaceFrom(
83 SDL_SetColorKey(iconSurf.
get(), SDL_TRUE, 0);
84 SDL_SetWindowIcon(
window.get(), iconSurf.
get());
96 auto flags = SDL_GetWindowFlags(
window.get());
99 bool currentState = (flags & SDL_WINDOW_FULLSCREEN) != 0;
100 if (currentState == fullscreen) {
105 if (SDL_SetWindowFullscreen(
window.get(),
106 fullscreen ? SDL_WINDOW_FULLSCREEN_DESKTOP : 0) != 0) {
Wrapper around a SDL_Surface.
void reset(SDL_Surface *surface_=nullptr)
void printWarning(std::string_view message)
Thrown when a subsystem initialisation fails.
~SDLVisibleSurfaceBase() override
void createSurface(int width, int height, unsigned flags)
virtual void fullScreenUpdated(bool fullscreen)=0
bool setFullScreen(bool fullscreen) override
void updateWindowTitle() override
Display & getDisplay() const
CliComm & getCliComm() const
SDLSurfacePtr load(const std::string &filename, bool want32bpp)
Load the given PNG file in a SDL_Surface.
This file implemented 3 utility functions:
const OpenMSX_Icon openMSX_icon
const FileContext & preferSystemFileContext()