15 int SDLVisibleSurfaceBase::windowPosX = SDL_WINDOWPOS_UNDEFINED;
16 int SDLVisibleSurfaceBase::windowPosY = SDL_WINDOWPOS_UNDEFINED;
23 if ((SDL_GetWindowFlags(
window.get()) & SDL_WINDOW_FULLSCREEN) == 0) {
24 SDL_GetWindowPosition(
window.get(), &windowPosX, &windowPosY);
33 if (
getDisplay().getRenderSettings().getFullScreen()) {
34 flags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
38 flags |= SDL_WINDOW_ALLOW_HIGHDPI;
42 window.reset(SDL_CreateWindow(
44 windowPosX, windowPosY,
48 std::string err = SDL_GetError();
55 SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY,
"1");
58 if constexpr (OPENMSX_SET_WINDOW_ICON) {
66 "Falling back to built in 32x32 icon, because failed to load icon: ",
69 iconSurf.
reset(SDL_CreateRGBSurfaceFrom(
81 SDL_SetColorKey(iconSurf.
get(), SDL_TRUE, 0);
82 SDL_SetWindowIcon(
window.get(), iconSurf.
get());
94 auto flags = SDL_GetWindowFlags(
window.get());
97 bool currentState = (flags & SDL_WINDOW_FULLSCREEN) != 0;
98 if (currentState == fullscreen) {
103 if (SDL_SetWindowFullscreen(
window.get(),
104 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:
OpenMSX_Icon openMSX_icon
const FileContext & preferSystemFileContext()