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

Cosmetic: rename windowScale to zoom

This commit is contained in:
Mathieu Schroeter 2017-12-14 23:10:24 +01:00
parent d27aaf4b3e
commit dc8f6319f0
5 changed files with 36 additions and 38 deletions

View File

@ -63,7 +63,7 @@ std::thread * g_updateThread = nullptr;
std::atomic<bool> g_updateAbort (false);
bool g_bFullScreen = false; // false si mode de test
Uint8 g_windowScale = 1;
Uint8 g_zoom = 1;
Sint32 g_speedRate = 1;
Sint32 g_timerInterval = 50; // inverval = 50ms
int g_rendererType = 0;
@ -150,9 +150,9 @@ ReadConfig ()
if (!(g_settingsOverload & SETTING_ZOOM) && j.find ("zoom") != j.end ())
{
g_windowScale = j["zoom"].get<Uint8> ();
if (g_windowScale != 1 && g_windowScale != 2)
g_windowScale = 1;
g_zoom = j["zoom"].get<Uint8> ();
if (g_zoom != 1 && g_zoom != 2)
g_zoom = 1;
}
if (
@ -640,9 +640,9 @@ parseArgs (int argc, char * argv[], bool & exit)
if (args["zoom"])
{
g_windowScale = args["zoom"];
if (g_windowScale != 1 && g_windowScale != 2)
g_windowScale = 1;
g_zoom = args["zoom"];
if (g_zoom != 1 && g_zoom != 2)
g_zoom = 1;
g_settingsOverload |= SETTING_ZOOM;
}
@ -977,19 +977,19 @@ DoInit (int argc, char * argv[], bool & exit)
return EXIT_FAILURE;
}
const bool zoom = g_windowScale;
const bool zoom = g_zoom;
g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie);
// Load all cursors
g_pPixmap->LoadCursors (g_windowScale);
g_pPixmap->LoadCursors (g_zoom);
g_pPixmap->ChangeSprite (SPRITE_WAIT);
g_updateThread = new std::thread (CheckForUpdates);
if (g_bFullScreen)
g_pEvent->SetFullScreen (true);
if (!g_bFullScreen && zoom != g_windowScale)
g_pEvent->SetWindowSize (g_windowScale);
if (!g_bFullScreen && zoom != g_zoom)
g_pEvent->SetWindowSize (g_zoom);
g_pEvent->ChangePhase (EV_PHASE_INTRO1);
g_bTermInit = true;

View File

@ -29,7 +29,7 @@
extern SDL_Window * g_window;
extern SDL_Renderer * g_renderer;
extern bool g_bFullScreen;
extern Uint8 g_windowScale;
extern Uint8 g_zoom;
extern bool g_restoreBugs;
extern bool g_restoreMidi;
extern bool g_enableRecorder;

View File

@ -1659,10 +1659,10 @@ CEvent::SetFullScreen (bool bFullScreen)
{
int x, y;
SDL_GetMouseState (&x, &y);
x /= g_windowScale;
y /= g_windowScale;
x /= g_zoom;
y /= g_zoom;
g_windowScale = 1;
g_zoom = 1;
SDL_SetWindowSize (g_window, LXIMAGE, LYIMAGE);
g_bFullScreen = bFullScreen;
@ -1672,7 +1672,7 @@ CEvent::SetFullScreen (bool bFullScreen)
SDL_SetWindowPosition (
g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
m_pPixmap->LoadCursors (g_windowScale);
m_pPixmap->LoadCursors (g_zoom);
m_pPixmap->ReloadTargetTextures ();
/* Force this update before otherwise the coordinates retrieved with
@ -1696,13 +1696,13 @@ CEvent::SetFullScreen (bool bFullScreen)
void
CEvent::SetWindowSize (Uint8 newScale)
{
auto scale = g_windowScale;
g_windowScale = newScale;
auto scale = g_zoom;
g_zoom = newScale;
switch (newScale)
{
case 1:
case 2:
SetWindowSize (scale, g_windowScale);
SetWindowSize (scale, g_zoom);
break;
default:
@ -2083,8 +2083,8 @@ CEvent::DrawButtons ()
SetEnable (EV_BUTTON3, !g_bFullScreen);
SetEnable (EV_BUTTON4, g_bFullScreen);
SetEnable (EV_BUTTON5, !g_bFullScreen && g_windowScale > 1);
SetEnable (EV_BUTTON6, !g_bFullScreen && g_windowScale < 2);
SetEnable (EV_BUTTON5, !g_bFullScreen && g_zoom > 1);
SetEnable (EV_BUTTON6, !g_bFullScreen && g_zoom < 2);
SetEnable (EV_BUTTON7, g_restoreMidi);
SetEnable (EV_BUTTON8, !g_restoreMidi);
@ -2570,7 +2570,7 @@ CEvent::DrawButtons ()
if (!g_bFullScreen)
{
snprintf (res, sizeof (res), "%dx", g_windowScale);
snprintf (res, sizeof (res), "%dx", g_zoom);
lg = GetTextWidth (res);
pos.x = (284 + 40) - lg / 2;
pos.y = 330 - 20;
@ -4114,18 +4114,18 @@ CEvent::ChangeButtons (Sint32 message)
break;
case EV_BUTTON5:
{
auto scale = g_windowScale;
if (g_windowScale > 1)
--g_windowScale;
SetWindowSize (scale, g_windowScale);
auto scale = g_zoom;
if (g_zoom > 1)
--g_zoom;
SetWindowSize (scale, g_zoom);
break;
}
case EV_BUTTON6:
{
auto scale = g_windowScale;
if (g_windowScale < 2)
++g_windowScale;
SetWindowSize (scale, g_windowScale);
auto scale = g_zoom;
if (g_zoom < 2)
++g_zoom;
SetWindowSize (scale, g_zoom);
break;
}
case EV_BUTTON7:
@ -4710,7 +4710,7 @@ CEvent::WriteInfo ()
: Language::undef);
info.musicMidi = g_restoreMidi;
info.fullScreen = g_bFullScreen;
info.zoom = g_windowScale;
info.zoom = g_zoom;
nb = fwrite (&info, sizeof (info), 1, file);
if (nb < 1)
@ -4776,7 +4776,7 @@ CEvent::ReadInfo ()
if (!(g_settingsOverload & SETTING_FULLSCREEN))
g_bFullScreen = !!info.fullScreen;
if (!(g_settingsOverload & SETTING_ZOOM))
g_windowScale = info.zoom;
g_zoom = info.zoom;
}
fclose (file);
@ -5154,8 +5154,7 @@ CEvent::DemoStep ()
pos.y = event.motion.y;
}
SDL_WarpMouseInWindow (
g_window, pos.x * g_windowScale, pos.y * g_windowScale);
SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom);
}
if (m_pDemoBuffer)

View File

@ -142,8 +142,8 @@ public:
void IntroStep ();
void SetWindowSize (Uint8 newScale);
void SetUpdateVersion (const std::string & version);
void SetWindowSize (Uint8 newScale);
void SetUpdateVersion (const std::string & version);
static void PushUserEvent (Sint32 code, void * data = nullptr);

View File

@ -187,8 +187,7 @@ CMenu::Create (
pos = m_pos;
pos.x += DIMBUTTONX / 2;
pos.y += DIMBUTTONY / 2;
SDL_WarpMouseInWindow (
g_window, pos.x * g_windowScale, pos.y * g_windowScale);
SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom);
}
m_selRank = Detect (pos);