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:
|
2021-12-25 09:18:51 +01:00
|
|
|
void init(const struct ScreenSettings* settings);
|
2021-09-07 03:56:39 +02:00
|
|
|
void destroy(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-12-25 09:18:51 +01:00
|
|
|
void GetSettings(struct ScreenSettings* settings);
|
2020-12-22 01:34:16 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
void LoadIcon(void);
|
2020-11-01 04:25:27 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
void ResizeScreen(int x, int y);
|
|
|
|
void ResizeToNearestMultiple(void);
|
|
|
|
void GetWindowSize(int* x, int* y);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
void UpdateScreen(SDL_Surface* buffer, SDL_Rect* rect);
|
|
|
|
void FlipScreen(bool flipmode);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
const SDL_PixelFormat* GetFormat(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
void toggleFullScreen(void);
|
2021-12-23 04:54:59 +01:00
|
|
|
void toggleScalingMode(void);
|
2021-09-07 03:56:39 +02:00
|
|
|
void toggleLinearFilter(void);
|
2021-09-15 05:23:22 +02:00
|
|
|
void toggleVSync(void);
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-12-26 07:55:55 +01:00
|
|
|
bool isForcedFullscreen(void);
|
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
bool isWindowed;
|
|
|
|
bool isFiltered;
|
|
|
|
bool badSignalEffect;
|
2021-12-23 04:54:59 +01:00
|
|
|
int scalingMode;
|
2021-09-07 03:56:39 +02:00
|
|
|
bool vsync;
|
2020-01-01 21:29:24 +01:00
|
|
|
|
2021-09-07 03:56:39 +02:00
|
|
|
SDL_Window *m_window;
|
|
|
|
SDL_Renderer *m_renderer;
|
|
|
|
SDL_Texture *m_screenTexture;
|
|
|
|
SDL_Surface* m_screen;
|
2020-01-01 21:29:24 +01:00
|
|
|
};
|
|
|
|
|
Extern `gameScreen`, remove `screenbuffer`
I know earlier I removed the gameScreen extern in favor of using
screenbuffer, but that was only to be consistent. After further
consideration, I have found that it's actually really stupid.
There's no reason to be accessing it through screenbuffer, and it's
probably an artifact of 2.0-2.2 passing stack-allocated otherwise-global
classes everywhere through function arguments. Also, it leads to stupid
bugs where screenbuffer could potentially be NULL, which has already
resulted in various annoying crashes in the past. Although those could
be fixed by simply initializing screenbuffer at the very top of main(),
but, why not just scrap the whole thing anyway?
So that's what I'm doing.
As a nice side effect, I've removed the transitive include of Screen.h
from Graphics.h. This could've been done already since it only includes
it for the pointer anyway, but it's still good to do it now.
2021-12-25 08:56:47 +01:00
|
|
|
#ifndef GAMESCREEN_DEFINITION
|
|
|
|
extern Screen gameScreen;
|
|
|
|
#endif
|
|
|
|
|
2020-01-01 21:29:24 +01:00
|
|
|
#endif /* SCREEN_H */
|