|
From: Lasse Kärkkäi. <tr...@us...> - 2009-09-01 07:28:16
|
Module: performous
Branch: master
Commit: 941d233862307657ba6463f2c9a21f7bbfc4250a
Author: Lasse Karkkainen <tro...@tr...>
Date: Tue Sep 1 10:13:01 2009 +0300
Use desktop resolution for full screen mode. Disable modesetting commandline options.
---
data/performous.xml | 18 +-----------------
game/main.cc | 9 +--------
game/video_driver.cc | 7 +++++--
game/video_driver.hh | 5 ++---
4 files changed, 9 insertions(+), 30 deletions(-)
diff --git a/data/performous.xml b/data/performous.xml
index 651b0a8..aa1d309 100644
--- a/data/performous.xml
+++ b/data/performous.xml
@@ -91,26 +91,10 @@
<long></long>
</locale>
</entry>
- <entry name="graphic/fs_width" type="int" value="1024">
- <ui unit=" px" />
- <limits min="320" max="4096" step="16" />
- <locale name="C">
- <short>Fullscreen width</short>
- <long></long>
- </locale>
- </entry>
- <entry name="graphic/fs_height" type="int" value="768">
- <ui unit=" px" />
- <limits min="240" max="2048" step="16" />
- <locale name="C">
- <short>Fullscreen height</short>
- <long></long>
- </locale>
- </entry>
<entry name="graphic/fullscreen" type="bool" value="false">
<locale name="C">
<short>Fullscreen mode</short>
- <long>Set width and height to suitable values first!</long>
+ <long></long>
</locale>
</entry>
<entry name="graphic/video" type="bool" value="true">
diff --git a/game/main.cc b/game/main.cc
index 064b4e8..965173d 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -138,7 +138,7 @@ void mainLoop() {
Songs songs(songlist);
Players players(getSharePath("performous.xml"));
ScreenManager sm;
- Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b(), config["graphic/fs_width"].i(), config["graphic/fs_height"].i());
+ Window window(config["graphic/window_width"].i(), config["graphic/window_height"].i(), config["graphic/fullscreen"].b());
sm.addScreen(new ScreenIntro("Intro", audio, capture));
sm.addScreen(new ScreenSongs("Songs", audio, songs));
sm.addScreen(new ScreenSing("Sing", audio, capture, players));
@@ -199,9 +199,6 @@ int main(int argc, char** argv) {
("songlist", po::value<std::string>(&songlist), "save a list of songs in the specified folder");
po::options_description opt2("Configuration options");
opt2.add_options()
- ("fs", po::value<bool>()->implicit_value(true), "start in full screen mode\n --fs=0 for windowed mode")
- ("width,W", po::value<int>(), "set horizontal resolution")
- ("height,H", po::value<int>(), "set vertical resolution")
("mics", po::value<std::vector<std::string> >(&mics)->composing(), "specify the microphones to use")
("pdev", po::value<std::vector<std::string> >(&pdevs)->composing(), "specify the playback device")
("michelp", "detailed help and device list for --mics")
@@ -277,10 +274,6 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
// Override XML config for options that were specified from commandline or performous.conf
- if (vm.count("fs")) config["graphic/fullscreen"].b() = vm["fs"].as<bool>();
- std::string graphic = config["graphic/fullscreen"].b() ? "graphic/fs_" : "graphic/window_";
- if (vm.count("width")) config[graphic + "width"].i() = vm["width"].as<int>();
- if (vm.count("height")) config[graphic + "height"].i() = vm["height"].as<int>();
confOverride(songdirs, "system/path_songs");
confOverride(mics, "audio/capture");
confOverride(pdevs, "audio/playback");
diff --git a/game/video_driver.cc b/game/video_driver.cc
index 9f6f4c9..d5ed163 100644
--- a/game/video_driver.cc
+++ b/game/video_driver.cc
@@ -15,7 +15,7 @@ namespace {
unsigned int screenW() { return s_width; }
unsigned int screenH() { return s_height; }
-Window::Window(unsigned int width, unsigned int height, int fs, unsigned int fs_width, unsigned int fs_height): m_windowW(width), m_windowH(height), m_fsW(fs_width), m_fsH(fs_height) {
+Window::Window(unsigned int width, unsigned int height, bool fs): m_windowW(width), m_windowH(height), m_fullscreen(fs) {
std::atexit(SDL_Quit);
if( SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK) == -1 ) throw std::runtime_error("SDL_Init failed");
SDL_WM_SetCaption(PACKAGE " " VERSION, PACKAGE);
@@ -24,7 +24,10 @@ Window::Window(unsigned int width, unsigned int height, int fs, unsigned int fs_
SDL_WM_SetIcon(icon, NULL);
SDL_FreeSurface(icon);
}
- m_fullscreen = (fs != 0);
+ // SDL_SetVideoMode not called yet => get the desktop resolution for fs mode
+ SDL_VideoInfo const* vi = SDL_GetVideoInfo();
+ m_fsW = vi->current_w;
+ m_fsH = vi->current_h;
resize();
SDL_ShowCursor(SDL_DISABLE);
SDL_EnableUNICODE(SDL_ENABLE);
diff --git a/game/video_driver.hh b/game/video_driver.hh
index b8c90dc..48364cf 100644
--- a/game/video_driver.hh
+++ b/game/video_driver.hh
@@ -14,7 +14,7 @@ class SDL_Surface;
class Window {
public:
/// constructor
- Window(unsigned int width, unsigned int height, int fullscreen, unsigned int fs_width, unsigned int fs_height);
+ Window(unsigned int windowW, unsigned int windowH, bool fullscreen);
/// destructor
~Window();
/// clears window
@@ -26,8 +26,7 @@ class Window {
* @param height the new height
*/
void resize(unsigned width, unsigned height) {
- if (m_fullscreen) { m_fsW = width; m_fsH = height; }
- else { m_windowW = width; m_windowH = height; }
+ if (!m_fullscreen) { m_windowW = width; m_windowH = height; }
resize();
}
/// does the resizing
|