git repos / blockattack-game

commit 1029dfed

Poul Sander · 2019-03-13 17:22
1029dfede9e04e5385075831455b70d936531f8d patch · browse files
parent ddf1da0e940107bd0a76d884b6a4a5a599cf0636

Add an option to always use the software renderer.

Changed files

M source/code/main.cpp before
M source/code/menudef.cpp before
M source/code/scopeHelpers.hpp before
diff --git a/source/code/main.cpp b/source/code/main.cpp index dd2d20d..d883e06 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Source information and contacts persons can be found at
-http://www.blockattack.net
+https://blockattack.net
===========================================================================
*/
@@ -1071,6 +1071,9 @@ int main(int argc, char* argv[]) {
cout << "Unable to load options file, using default values" << "\n";
}
}
+ if (configSettings->getInt("always-software")) {
+ config.softwareRenderer = true;
+ }
// "Block Attack - Rise of the Blocks"
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "2");
diff --git a/source/code/menudef.cpp b/source/code/menudef.cpp index 837278f..49325f2 100644 --- a/source/code/menudef.cpp +++ b/source/code/menudef.cpp
@@ -210,12 +210,24 @@ static void runTwoPlayerVs() {
runGame(Gametype::TwoPlayerVs, 0);
}
+static void SetAlwaysSoftwareLabel(Button* b) {
+ b->setLabel(Config::getInstance()->getInt("always-software")?
+ _("Always use software render: On")
+ : _("Always use software render: Off"));
+}
+
+class AlwaysSoftwareRenderButton : public Button {
+ virtual void doAction() override {
+ Config::getInstance()->setInt("always-software", !Config::getInstance()->getInt("always-software"));
+ SetAlwaysSoftwareLabel(this);
+ }
+};
+
class MusicButton : public Button {
virtual void doAction() override {
globalData.MusicEnabled = !globalData.MusicEnabled;
setLabel(globalData.MusicEnabled? _("Music: On") : _("Music: Off"));
}
-
};
class SoundButton : public Button {
@@ -278,9 +290,11 @@ static void ConfigureMenu() {
Menu cm(globalData.screen,_("Configuration"),true);
Button bPlayer1Name,bPlayer2Name;
Button bPlayer1Keys, bPlayer2Keys;
+ AlwaysSoftwareRenderButton bSoftware;
MusicButton bMusic;
SoundButton bSound;
FullscreenButton buttonFullscreen;
+ SetAlwaysSoftwareLabel(&bSoftware);
bMusic.setLabel(globalData.MusicEnabled? _("Music: On") : _("Music: Off") );
bSound.setLabel(globalData.SoundEnabled? _("Sound: On") : _("Sound: Off") );
buttonFullscreen.setLabel(globalData.bFullscreen? _("Fullscreen: On") : _("Fullscreen: Off") );
@@ -294,6 +308,7 @@ static void ConfigureMenu() {
bPlayer2Keys.setLabel(_("Change player 2's keys") );
cm.addButton(&bMusic);
cm.addButton(&bSound);
+ cm.addButton(&bSoftware);
cm.addButton(&buttonFullscreen);
cm.addButton(&bPlayer1Name);
cm.addButton(&bPlayer2Name);
diff --git a/source/code/scopeHelpers.hpp b/source/code/scopeHelpers.hpp index 626de7e..dc8027c 100644 --- a/source/code/scopeHelpers.hpp +++ b/source/code/scopeHelpers.hpp
@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses/
Source information and contacts persons can be found at
-http://www.blockattack.net
+https://blockattack.net
===========================================================================
*/