1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Add the option for chaning the render quality

It toggles between 'nearest' (faster) and 'best' (slower but more
prettier). It's enabled only when the game runs in fullscreen.

The option can be passed by command line argument `--render-quality on`,
by settings.json file with a `"renderquality": true` entry or simply
with the main settings screen in the game.
This commit is contained in:
Mathieu Schroeter 2018-08-06 07:20:23 +02:00
parent 1609df9339
commit 8b7142a084
12 changed files with 212 additions and 16 deletions

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"POT-Creation-Date: 2018-08-06 06:55+0200\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -231,6 +231,9 @@ msgstr "Das war mal wieder nichts !"
msgid "Bank"
msgstr "Ufer"
msgid "Best"
msgstr ""
msgid "Blow up"
msgstr "Zünden"
@ -290,6 +293,14 @@ msgstr ""
"Fentergrösse\n"
"anpassen"
#, fuzzy
msgid ""
"Change the\n"
"render quality"
msgstr ""
"Fentergrösse\n"
"anpassen"
msgid ""
"Change the\n"
"window size"
@ -612,6 +623,10 @@ msgstr "Musik Nummer 9"
msgid "N"
msgstr "N"
#, fuzzy
msgid "Nearest"
msgstr "Wald"
#, c-format
msgid "New version available for download on www.blupi.org (v%s)"
msgstr "Neue Version (v%s) auf www.blupi.org zum Download verfügbar"
@ -882,6 +897,12 @@ msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Use the best render quality"
msgstr ""
msgid "Use the nearest render quality"
msgstr ""
msgid "Version"
msgstr "Version"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"POT-Creation-Date: 2018-08-06 06:55+0200\n"
"PO-Revision-Date: 2017-02-27 21:28+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -187,6 +187,9 @@ msgstr ""
msgid "Bank"
msgstr ""
msgid "Best"
msgstr ""
msgid "Blow up"
msgstr ""
@ -243,6 +246,11 @@ msgid ""
"display mode"
msgstr ""
msgid ""
"Change the\n"
"render quality"
msgstr ""
msgid ""
"Change the\n"
"window size"
@ -552,6 +560,9 @@ msgstr ""
msgid "N"
msgstr ""
msgid "Nearest"
msgstr ""
#, c-format
msgid "New version available for download on www.blupi.org (v%s)"
msgstr ""
@ -809,6 +820,12 @@ msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Use the best render quality"
msgstr ""
msgid "Use the nearest render quality"
msgstr ""
msgid "Version"
msgstr ""

View File

@ -6,15 +6,15 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"PO-Revision-Date: 2018-06-30 15:36+0200\n"
"POT-Creation-Date: 2018-08-06 06:55+0200\n"
"PO-Revision-Date: 2018-08-06 07:16+0200\n"
"Last-Translator: Mathieu Schroeter <mathieu@schroetersa.ch>\n"
"Language-Team: French <kde-i18n-doc@kde.org>\n"
"Language: fr\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.0.8\n"
"X-Generator: Poedit 2.0.9\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid " - FFmpeg (LGPLv2.1)"
@ -229,6 +229,9 @@ msgstr "Paf, c'est raté !"
msgid "Bank"
msgstr "Rive"
msgid "Best"
msgstr "Meilleure"
msgid "Blow up"
msgstr "Explose"
@ -287,6 +290,13 @@ msgstr ""
"Modifie le mode\n"
"d'affichage"
msgid ""
"Change the\n"
"render quality"
msgstr ""
"Modifie la\n"
"qualité de rendu"
msgid ""
"Change the\n"
"window size"
@ -609,6 +619,9 @@ msgstr "Musique numéro 9"
msgid "N"
msgstr "N"
msgid "Nearest"
msgstr "Au plus proche"
#, c-format
msgid "New version available for download on www.blupi.org (v%s)"
msgstr "Nouvelle version disponible au téléchargement sur www.blupi.org (v%s)"
@ -874,6 +887,12 @@ msgstr "Utilise la musique Midi (originale)"
msgid "Use Ogg music"
msgstr "Utilise la musique Ogg"
msgid "Use the best render quality"
msgstr "Utilise la meilleure qualité de rendu"
msgid "Use the nearest render quality"
msgstr "Utilise la qualité de rendu au plus proche"
msgid "Version"
msgstr "Version"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"POT-Creation-Date: 2018-08-06 06:55+0200\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
@ -229,6 +229,9 @@ msgstr "Bang, hai sbagliato ancora !"
msgid "Bank"
msgstr "Riva"
msgid "Best"
msgstr ""
msgid "Blow up"
msgstr "Espoldi"
@ -289,6 +292,15 @@ msgstr ""
"dimensione\n"
"della finestra"
#, fuzzy
msgid ""
"Change the\n"
"render quality"
msgstr ""
"Cambiare la\n"
"dimensione\n"
"della finestra"
msgid ""
"Change the\n"
"window size"
@ -611,6 +623,10 @@ msgstr "Musica numero 9"
msgid "N"
msgstr "N"
#, fuzzy
msgid "Nearest"
msgstr "Foresta"
#, c-format
msgid "New version available for download on www.blupi.org (v%s)"
msgstr "Nuova versione disponibile su www.blupi.org (v%s)"
@ -876,6 +892,12 @@ msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Use the best render quality"
msgstr ""
msgid "Use the nearest render quality"
msgstr ""
msgid "Version"
msgstr "Versione"

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"POT-Creation-Date: 2018-08-06 06:55+0200\n"
"PO-Revision-Date: 2017-12-14 23:15+0100\n"
"Last-Translator: tomangelo <tomangelo@wp.pl>\n"
"Language-Team: TerranovaTeam <contact@colobot.info>\n"
@ -230,6 +230,9 @@ msgstr "Motyla noga, znowu porażka!"
msgid "Bank"
msgstr "Brzeg"
msgid "Best"
msgstr ""
msgid "Blow up"
msgstr "Wysadź w powietrze"
@ -289,6 +292,14 @@ msgstr ""
"Zmień rozmiar\n"
"okna"
#, fuzzy
msgid ""
"Change the\n"
"render quality"
msgstr ""
"Zmień rozmiar\n"
"okna"
msgid ""
"Change the\n"
"window size"
@ -608,6 +619,10 @@ msgstr "Muzyka numer 9"
msgid "N"
msgstr "Pn"
#, fuzzy
msgid "Nearest"
msgstr "Las"
#, c-format
msgid "New version available for download on www.blupi.org (v%s)"
msgstr "Nowa wersja dostępna do pobrania na www.blupi.org (v%s)"
@ -873,6 +888,12 @@ msgstr ""
msgid "Use Ogg music"
msgstr ""
msgid "Use the best render quality"
msgstr ""
msgid "Use the nearest render quality"
msgstr ""
msgid "Version"
msgstr "Wersja"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-30 15:35+0200\n"
"POT-Creation-Date: 2018-08-06 07:13+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -551,6 +551,12 @@ msgstr ""
msgid "Use Midi music (original)"
msgstr ""
msgid "Use the nearest render quality"
msgstr ""
msgid "Use the best render quality"
msgstr ""
msgid "Version"
msgstr ""
@ -727,6 +733,11 @@ msgid ""
"music format"
msgstr ""
msgid ""
"Change the\n"
"render quality"
msgstr ""
msgid "Legacy"
msgstr ""
@ -739,6 +750,12 @@ msgstr ""
msgid "Ogg"
msgstr ""
msgid "Best"
msgstr ""
msgid "Nearest"
msgstr ""
msgid "You have played Planet Blupi."
msgstr ""

View File

@ -74,6 +74,7 @@ bool g_enableRecorder = false;
std::string g_playRecord;
bool g_restoreBugs = false; // restore original < v1.9 bugs
bool g_restoreMidi = false; // restore music playback based on midi files
bool g_renderQuality = true; // use the best render quality with scaling
int g_settingsOverload = 0;
bool g_bTermInit = false; // initialisation en cours
@ -182,6 +183,11 @@ ReadConfig ()
!(g_settingsOverload & SETTING_MIDI) && j.find ("restoremidi") != j.end ())
g_restoreMidi = j["restoremidi"].get<bool> ();
if (
!(g_settingsOverload & SETTING_RENDERQUALITY) &&
j.find ("renderquality") != j.end ())
g_renderQuality = j["renderqiality"].get<bool> ();
return true;
}
@ -608,7 +614,12 @@ parseArgs (int argc, char * argv[], bool & exit)
{"restoremidi",
{"-m", "--restore-midi"},
"restore playback based on MIDI music instead of OGG",
0}}};
0},
{"renderquality",
{"-q", "--render-quality"},
"enable the best render quality [on;off] (default: on, ignored if "
"windowed)",
1}}};
argagg::parser_results args;
try
@ -706,6 +717,13 @@ parseArgs (int argc, char * argv[], bool & exit)
g_settingsOverload |= SETTING_MIDI;
}
if (args["renderquality"])
{
g_renderQuality =
args["renderquality"].as<std::string> () != std::string ("off");
g_settingsOverload |= SETTING_RENDERQUALITY;
}
return EXIT_SUCCESS;
}

View File

@ -36,6 +36,7 @@ extern bool g_bFullScreen;
extern Uint8 g_zoom;
extern bool g_restoreBugs;
extern bool g_restoreMidi;
extern bool g_renderQuality;
extern bool g_enableRecorder;
extern std::string g_playRecord;
extern CEvent * g_pEvent;
@ -51,6 +52,7 @@ enum Settings {
SETTING_DRIVER = 1 << 5,
SETTING_MIDI = 1 << 6,
SETTING_LEGACY = 1 << 7,
SETTING_RENDERQUALITY = 1 << 8,
};
extern int g_settingsOverload;

View File

@ -75,8 +75,10 @@ typedef struct {
Sint16 musicMidi;
Sint16 fullScreen;
Sint16 zoom;
// v1.3
Sint16 renderQuality;
Sint16 reserve2[89];
Sint16 reserve2[88];
} DescInfo;
// Toutes les premières lettres doivent
@ -1576,6 +1578,18 @@ static Phase table[] =
399 + 40, 330,
{ translate ("Use Midi music (original)") },
},
{
EV_BUTTON9,
0, {1, 50},
514, 330,
{ translate ("Use the nearest render quality") },
},
{
EV_BUTTON10,
0, {1, 51},
514 + 40, 330,
{ translate ("Use the best render quality") },
},
{
EV_PHASE_INIT,
0, {1, 40},
@ -2202,6 +2216,9 @@ CEvent::DrawButtons ()
SetEnable (EV_BUTTON7, g_restoreMidi && mid && ogg);
SetEnable (EV_BUTTON8, !g_restoreMidi && mid && ogg);
SetEnable (EV_BUTTON9, g_bFullScreen && g_renderQuality);
SetEnable (EV_BUTTON10, g_bFullScreen && !g_renderQuality);
table[m_index].buttons[4].toolTips[0] =
g_bFullScreen ? gettext ("Desktop mode") : gettext ("Reduce window size");
table[m_index].buttons[5].toolTips[0] =
@ -2673,6 +2690,8 @@ CEvent::DrawButtons ()
284 + 40 + LXOFFSET (), 80);
DrawTextCenter (
gettext ("Choose the\nmusic format"), 399 + 40 + LXOFFSET (), 80);
DrawTextCenter (
gettext ("Change the\nrender quality"), 514 + 40 + LXOFFSET (), 80);
const auto locale = GetLocale ();
std::string lang;
@ -2718,6 +2737,12 @@ CEvent::DrawButtons ()
pos.x = (399 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text);
text = g_renderQuality ? gettext ("Best") : gettext ("Nearest");
lg = GetTextWidth (text);
pos.x = (514 + 40) - lg / 2 + LXOFFSET ();
pos.y = 330 - 20;
DrawText (m_pPixmap, pos, text);
}
// Show the ending text
@ -4346,6 +4371,14 @@ CEvent::ChangeButtons (Sint32 message)
case EV_BUTTON8:
g_restoreMidi = true;
break;
case EV_BUTTON9:
g_renderQuality = false;
this->m_pPixmap->CreateMainTexture ();
break;
case EV_BUTTON10:
g_renderQuality = true;
this->m_pPixmap->CreateMainTexture ();
break;
}
}
}
@ -4903,7 +4936,7 @@ CEvent::WriteInfo ()
goto error;
info.majRev = 1;
info.minRev = 2;
info.minRev = 3;
info.prive = m_private;
info.exercice = m_exercice;
info.mission = m_mission;
@ -4922,9 +4955,10 @@ CEvent::WriteInfo ()
info.language = static_cast<Sint16> (
this->GetLanguage () != this->GetStartLanguage () ? this->GetLanguage ()
: Language::undef);
info.musicMidi = g_restoreMidi;
info.fullScreen = g_bFullScreen;
info.zoom = g_zoom;
info.musicMidi = g_restoreMidi;
info.fullScreen = g_bFullScreen;
info.zoom = g_zoom;
info.renderQuality = g_renderQuality;
nb = fwrite (&info, sizeof (info), 1, file);
if (nb < 1)
@ -4997,6 +5031,12 @@ CEvent::ReadInfo ()
g_zoom = 1;
}
if (((info.majRev == 1 && info.minRev >= 3) || info.majRev >= 2))
{
if (!(g_settingsOverload & SETTING_RENDERQUALITY))
g_renderQuality = !!info.renderQuality;
}
fclose (file);
return true;

View File

@ -139,7 +139,8 @@ CMovie::fileOpenMovie (const std::string & pFilename)
SDL_PauseAudioDevice (m_audioDev, 0);
if (g_bFullScreen && g_zoom == 1)
SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "best");
SDL_SetHint (
SDL_HINT_RENDER_SCALE_QUALITY, g_renderQuality ? "best" : "nearest");
m_videoTex = SDL_CreateTexture (
g_renderer, info.video.output.format, SDL_TEXTUREACCESS_TARGET,
info.video.output.width, info.video.output.height);

View File

@ -107,6 +107,22 @@ CPixmap::Create (Point dim)
return true;
}
void
CPixmap::CreateMainTexture ()
{
if (!this->mainTexture)
return;
SDL_DestroyTexture (this->mainTexture);
SDL_SetHint (
SDL_HINT_RENDER_SCALE_QUALITY,
g_bFullScreen && g_renderQuality ? "best" : "nearest");
this->mainTexture = SDL_CreateTexture (
g_renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET, LXIMAGE (),
LYIMAGE ());
SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
}
Sint32
CPixmap::BltFast (Sint32 dstCh, size_t srcCh, Rect dstR, Rect srcR)
{
@ -128,7 +144,8 @@ CPixmap::BltFast (Sint32 dstCh, size_t srcCh, Rect dstR, Rect srcR)
{
if (!this->mainTexture && g_bFullScreen && g_zoom == 1)
{
SDL_SetHint (SDL_HINT_RENDER_SCALE_QUALITY, "best");
SDL_SetHint (
SDL_HINT_RENDER_SCALE_QUALITY, g_renderQuality ? "best" : "nearest");
this->mainTexture = SDL_CreateTexture (
g_renderer, SDL_PIXELFORMAT_RGBA32, SDL_TEXTUREACCESS_TARGET,
LXIMAGE (), LYIMAGE ());

View File

@ -63,6 +63,7 @@ public:
bool Create (Point dim);
void CreateMainTexture ();
bool ReloadTargetTextures ();
bool Cache (size_t channel, Point totalDim);
bool Cache (