2020-01-01 21:29:24 +01:00
|
|
|
#ifndef SCREEN_H
|
|
|
|
#define SCREEN_H
|
|
|
|
|
|
|
|
#include <SDL.h>
|
|
|
|
|
2020-11-13 01:29:11 +01:00
|
|
|
#include "ScreenSettings.h"
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
class Screen
|
|
|
|
{
|
|
|
|
public:
|
2020-11-13 01:29:11 +01:00
|
|
|
void init(const ScreenSettings& settings);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2020-12-22 01:34:16 +01:00
|
|
|
void GetSettings(ScreenSettings* settings);
|
|
|
|
|
2020-11-01 04:25:27 +01:00
|
|
|
void LoadIcon();
|
|
|
|
|
2020-03-13 23:22:37 +01:00
|
|
|
void ResizeScreen(int x, int y);
|
Add "resize to nearest" graphics option
If you want your game window to simply be exactly 320x240, or 640x480,
or 960x720 etc. then it's really annoying that there's no easy way to do
this (to clarify, this is different from integer mode, which controls
the size of the game INSIDE the window). The easiest way would be having
to close the game, go into unlock.vvv, and edit the window size
manually. VCE has a 1x/2x/3x/4x graphics option to solve this, although
it does not account for actual monitor size (those 1x/2x/3x/4x modes are
all you get, whether or not you have a monitor too small for some of
them or too big for any of them to be what you want).
I discussed this with flibit, and he said that VCE's approach (if it
accounted for monitor size) wouldn't work on high-retina displays or
high DPIs, because getting the actual multiplier to account for those
monitors is kind of a pain. So the next best thing would be to add an
option that resizes to the nearest perfect multiple of 320x240. That way
you could simply resize the window and let the game correct any
imperfect dimensions automatically.
2020-06-30 07:02:21 +02:00
|
|
|
void ResizeToNearestMultiple();
|
2020-01-01 21:29:24 +01:00
|
|
|
void GetWindowSize(int* x, int* y);
|
|
|
|
|
|
|
|
void UpdateScreen(SDL_Surface* buffer, SDL_Rect* rect);
|
|
|
|
void FlipScreen();
|
|
|
|
|
|
|
|
const SDL_PixelFormat* GetFormat();
|
|
|
|
|
2020-03-13 23:22:37 +01:00
|
|
|
void toggleFullScreen();
|
2020-01-01 21:29:24 +01:00
|
|
|
void toggleStretchMode();
|
|
|
|
void toggleLinearFilter();
|
2020-07-02 06:19:40 +02:00
|
|
|
void resetRendererWorkaround();
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
bool isWindowed;
|
|
|
|
bool isFiltered;
|
|
|
|
bool badSignalEffect;
|
|
|
|
int stretchMode;
|
2020-07-02 06:19:40 +02:00
|
|
|
bool vsync;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
|
|
|
SDL_Window *m_window;
|
|
|
|
SDL_Renderer *m_renderer;
|
|
|
|
SDL_Texture *m_screenTexture;
|
|
|
|
SDL_Surface* m_screen;
|
|
|
|
|
|
|
|
SDL_Rect filterSubrect;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* SCREEN_H */
|