mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Factor out screen settings to ScreenSettings struct
It's a bit annoying to pass each screen setting individually, would be nice if we could just wrap it up in a nice struct and pass that instead.
This commit is contained in:
parent
9f5f697dda
commit
af11f6936a
3 changed files with 39 additions and 24 deletions
|
@ -17,23 +17,27 @@ extern "C"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::init(
|
ScreenSettings::ScreenSettings()
|
||||||
int windowWidth,
|
{
|
||||||
int windowHeight,
|
windowWidth = 320;
|
||||||
bool fullscreen,
|
windowHeight = 240;
|
||||||
bool useVsync,
|
fullscreen = false;
|
||||||
int stretch,
|
useVsync = false;
|
||||||
bool linearFilter,
|
stretch = 0;
|
||||||
bool badSignal
|
linearFilter = false;
|
||||||
) {
|
badSignal = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Screen::init(const ScreenSettings& settings)
|
||||||
|
{
|
||||||
m_window = NULL;
|
m_window = NULL;
|
||||||
m_renderer = NULL;
|
m_renderer = NULL;
|
||||||
m_screenTexture = NULL;
|
m_screenTexture = NULL;
|
||||||
m_screen = NULL;
|
m_screen = NULL;
|
||||||
isWindowed = !fullscreen;
|
isWindowed = !settings.fullscreen;
|
||||||
stretchMode = stretch;
|
stretchMode = settings.stretch;
|
||||||
isFiltered = linearFilter;
|
isFiltered = settings.linearFilter;
|
||||||
vsync = useVsync;
|
vsync = settings.useVsync;
|
||||||
filterSubrect.x = 1;
|
filterSubrect.x = 1;
|
||||||
filterSubrect.y = 1;
|
filterSubrect.y = 1;
|
||||||
filterSubrect.w = 318;
|
filterSubrect.w = 318;
|
||||||
|
@ -84,9 +88,9 @@ void Screen::init(
|
||||||
240
|
240
|
||||||
);
|
);
|
||||||
|
|
||||||
badSignalEffect = badSignal;
|
badSignalEffect = settings.badSignal;
|
||||||
|
|
||||||
ResizeScreen(windowWidth, windowHeight);
|
ResizeScreen(settings.windowWidth, settings.windowHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Screen::LoadIcon()
|
void Screen::LoadIcon()
|
||||||
|
|
|
@ -3,18 +3,12 @@
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
|
|
||||||
|
#include "ScreenSettings.h"
|
||||||
|
|
||||||
class Screen
|
class Screen
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
void init(
|
void init(const ScreenSettings& settings);
|
||||||
int windowWidth,
|
|
||||||
int windowHeight,
|
|
||||||
bool fullscreen,
|
|
||||||
bool useVsync,
|
|
||||||
int stretch,
|
|
||||||
bool linearFilter,
|
|
||||||
bool badSignal
|
|
||||||
);
|
|
||||||
|
|
||||||
void LoadIcon();
|
void LoadIcon();
|
||||||
|
|
||||||
|
|
17
desktop_version/src/ScreenSettings.h
Normal file
17
desktop_version/src/ScreenSettings.h
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef SCREENSETTINGS_H
|
||||||
|
#define SCREENSETTINGS_H
|
||||||
|
|
||||||
|
struct ScreenSettings
|
||||||
|
{
|
||||||
|
ScreenSettings();
|
||||||
|
|
||||||
|
int windowWidth;
|
||||||
|
int windowHeight;
|
||||||
|
bool fullscreen;
|
||||||
|
bool useVsync;
|
||||||
|
int stretch;
|
||||||
|
bool linearFilter;
|
||||||
|
bool badSignal;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif /* SCREENSETTINGS_H */
|
Loading…
Reference in a new issue