mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-06-26 06:28:30 +02:00
This fixes the following bug that only occurs on Wayland: If the game is configured to be fullscreened and in stretch mode, on startup, it won't be in stretch mode. It will appear to be in letterbox mode, but the game still thinks it's in stretch mode. This is because during the ResizeScreen() call on startup, for whatever reason, the window size will be reported to be the default size (640 by 480) instead of the screen resolution of the monitor, as one would expect from being in fullscreen. It seems like when the game queries the window size, the window isn't actually in fullscreen at that time, even though this is after fullscreen has been set to true. To fix this, I decided to always update the logical size before SDL_RenderPresent() is called. To make this neater, I put the scaling code in its own function named UpdateScaling(). This bug has existed since 2.3 and does not occur on X11. I tested this on GNOME Wayland, and for testing it on X11, I used Openbox in a Xephyr session while running VVVVVV with SDL_VIDEODRIVER=x11.
49 lines
897 B
C++
49 lines
897 B
C++
#ifndef SCREEN_H
|
|
#define SCREEN_H
|
|
|
|
#include <SDL.h>
|
|
|
|
#include "ScreenSettings.h"
|
|
|
|
class Screen
|
|
{
|
|
public:
|
|
void init(const struct ScreenSettings* settings);
|
|
void destroy(void);
|
|
|
|
void GetSettings(struct ScreenSettings* settings);
|
|
|
|
void LoadIcon(void);
|
|
|
|
void ResizeScreen(int x, int y);
|
|
void ResizeToNearestMultiple(void);
|
|
void GetWindowSize(int* x, int* y);
|
|
|
|
void UpdateScaling(void);
|
|
void RenderPresent(void);
|
|
|
|
void toggleFullScreen(void);
|
|
void toggleScalingMode(void);
|
|
void toggleLinearFilter(void);
|
|
void toggleVSync(void);
|
|
|
|
void recacheTextures(void);
|
|
|
|
bool isForcedFullscreen(void);
|
|
|
|
bool isWindowed;
|
|
bool isFiltered;
|
|
bool badSignalEffect;
|
|
int scalingMode;
|
|
bool vsync;
|
|
|
|
SDL_Window *m_window;
|
|
SDL_Renderer *m_renderer;
|
|
};
|
|
|
|
#ifndef GAMESCREEN_DEFINITION
|
|
extern Screen gameScreen;
|
|
#endif
|
|
|
|
#endif /* SCREEN_H */
|