1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-26 14:38:30 +02:00
VVVVVV/desktop_version/src/Screen.h
Misa d0ffafe117 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 00:29:28 -08:00

49 lines
956 B
C++

#ifndef SCREEN_H
#define SCREEN_H
#include <SDL.h>
#include "ScreenSettings.h"
class Screen
{
public:
void init(const ScreenSettings& settings);
void destroy(void);
void GetSettings(ScreenSettings* settings);
void LoadIcon(void);
void ResizeScreen(int x, int y);
void ResizeToNearestMultiple(void);
void GetWindowSize(int* x, int* y);
void UpdateScreen(SDL_Surface* buffer, SDL_Rect* rect);
void FlipScreen(bool flipmode);
const SDL_PixelFormat* GetFormat(void);
void toggleFullScreen(void);
void toggleScalingMode(void);
void toggleLinearFilter(void);
void toggleVSync(void);
bool isWindowed;
bool isFiltered;
bool badSignalEffect;
int scalingMode;
bool vsync;
SDL_Window *m_window;
SDL_Renderer *m_renderer;
SDL_Texture *m_screenTexture;
SDL_Surface* m_screen;
};
#ifndef GAMESCREEN_DEFINITION
extern Screen gameScreen;
#endif
#endif /* SCREEN_H */