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:
parent
d27aaf4b3e
commit
dc8f6319f0
@ -63,7 +63,7 @@ std::thread * g_updateThread = nullptr;
|
|||||||
std::atomic<bool> g_updateAbort (false);
|
std::atomic<bool> g_updateAbort (false);
|
||||||
|
|
||||||
bool g_bFullScreen = false; // false si mode de test
|
bool g_bFullScreen = false; // false si mode de test
|
||||||
Uint8 g_windowScale = 1;
|
Uint8 g_zoom = 1;
|
||||||
Sint32 g_speedRate = 1;
|
Sint32 g_speedRate = 1;
|
||||||
Sint32 g_timerInterval = 50; // inverval = 50ms
|
Sint32 g_timerInterval = 50; // inverval = 50ms
|
||||||
int g_rendererType = 0;
|
int g_rendererType = 0;
|
||||||
@ -150,9 +150,9 @@ ReadConfig ()
|
|||||||
|
|
||||||
if (!(g_settingsOverload & SETTING_ZOOM) && j.find ("zoom") != j.end ())
|
if (!(g_settingsOverload & SETTING_ZOOM) && j.find ("zoom") != j.end ())
|
||||||
{
|
{
|
||||||
g_windowScale = j["zoom"].get<Uint8> ();
|
g_zoom = j["zoom"].get<Uint8> ();
|
||||||
if (g_windowScale != 1 && g_windowScale != 2)
|
if (g_zoom != 1 && g_zoom != 2)
|
||||||
g_windowScale = 1;
|
g_zoom = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@ -640,9 +640,9 @@ parseArgs (int argc, char * argv[], bool & exit)
|
|||||||
|
|
||||||
if (args["zoom"])
|
if (args["zoom"])
|
||||||
{
|
{
|
||||||
g_windowScale = args["zoom"];
|
g_zoom = args["zoom"];
|
||||||
if (g_windowScale != 1 && g_windowScale != 2)
|
if (g_zoom != 1 && g_zoom != 2)
|
||||||
g_windowScale = 1;
|
g_zoom = 1;
|
||||||
g_settingsOverload |= SETTING_ZOOM;
|
g_settingsOverload |= SETTING_ZOOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -977,19 +977,19 @@ DoInit (int argc, char * argv[], bool & exit)
|
|||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool zoom = g_windowScale;
|
const bool zoom = g_zoom;
|
||||||
|
|
||||||
g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie);
|
g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie);
|
||||||
|
|
||||||
// Load all cursors
|
// Load all cursors
|
||||||
g_pPixmap->LoadCursors (g_windowScale);
|
g_pPixmap->LoadCursors (g_zoom);
|
||||||
g_pPixmap->ChangeSprite (SPRITE_WAIT);
|
g_pPixmap->ChangeSprite (SPRITE_WAIT);
|
||||||
|
|
||||||
g_updateThread = new std::thread (CheckForUpdates);
|
g_updateThread = new std::thread (CheckForUpdates);
|
||||||
if (g_bFullScreen)
|
if (g_bFullScreen)
|
||||||
g_pEvent->SetFullScreen (true);
|
g_pEvent->SetFullScreen (true);
|
||||||
if (!g_bFullScreen && zoom != g_windowScale)
|
if (!g_bFullScreen && zoom != g_zoom)
|
||||||
g_pEvent->SetWindowSize (g_windowScale);
|
g_pEvent->SetWindowSize (g_zoom);
|
||||||
g_pEvent->ChangePhase (EV_PHASE_INTRO1);
|
g_pEvent->ChangePhase (EV_PHASE_INTRO1);
|
||||||
|
|
||||||
g_bTermInit = true;
|
g_bTermInit = true;
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
extern SDL_Window * g_window;
|
extern SDL_Window * g_window;
|
||||||
extern SDL_Renderer * g_renderer;
|
extern SDL_Renderer * g_renderer;
|
||||||
extern bool g_bFullScreen;
|
extern bool g_bFullScreen;
|
||||||
extern Uint8 g_windowScale;
|
extern Uint8 g_zoom;
|
||||||
extern bool g_restoreBugs;
|
extern bool g_restoreBugs;
|
||||||
extern bool g_restoreMidi;
|
extern bool g_restoreMidi;
|
||||||
extern bool g_enableRecorder;
|
extern bool g_enableRecorder;
|
||||||
|
@ -1659,10 +1659,10 @@ CEvent::SetFullScreen (bool bFullScreen)
|
|||||||
{
|
{
|
||||||
int x, y;
|
int x, y;
|
||||||
SDL_GetMouseState (&x, &y);
|
SDL_GetMouseState (&x, &y);
|
||||||
x /= g_windowScale;
|
x /= g_zoom;
|
||||||
y /= g_windowScale;
|
y /= g_zoom;
|
||||||
|
|
||||||
g_windowScale = 1;
|
g_zoom = 1;
|
||||||
SDL_SetWindowSize (g_window, LXIMAGE, LYIMAGE);
|
SDL_SetWindowSize (g_window, LXIMAGE, LYIMAGE);
|
||||||
|
|
||||||
g_bFullScreen = bFullScreen;
|
g_bFullScreen = bFullScreen;
|
||||||
@ -1672,7 +1672,7 @@ CEvent::SetFullScreen (bool bFullScreen)
|
|||||||
SDL_SetWindowPosition (
|
SDL_SetWindowPosition (
|
||||||
g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
g_window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
|
||||||
|
|
||||||
m_pPixmap->LoadCursors (g_windowScale);
|
m_pPixmap->LoadCursors (g_zoom);
|
||||||
m_pPixmap->ReloadTargetTextures ();
|
m_pPixmap->ReloadTargetTextures ();
|
||||||
|
|
||||||
/* Force this update before otherwise the coordinates retrieved with
|
/* Force this update before otherwise the coordinates retrieved with
|
||||||
@ -1696,13 +1696,13 @@ CEvent::SetFullScreen (bool bFullScreen)
|
|||||||
void
|
void
|
||||||
CEvent::SetWindowSize (Uint8 newScale)
|
CEvent::SetWindowSize (Uint8 newScale)
|
||||||
{
|
{
|
||||||
auto scale = g_windowScale;
|
auto scale = g_zoom;
|
||||||
g_windowScale = newScale;
|
g_zoom = newScale;
|
||||||
switch (newScale)
|
switch (newScale)
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
SetWindowSize (scale, g_windowScale);
|
SetWindowSize (scale, g_zoom);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2083,8 +2083,8 @@ CEvent::DrawButtons ()
|
|||||||
SetEnable (EV_BUTTON3, !g_bFullScreen);
|
SetEnable (EV_BUTTON3, !g_bFullScreen);
|
||||||
SetEnable (EV_BUTTON4, g_bFullScreen);
|
SetEnable (EV_BUTTON4, g_bFullScreen);
|
||||||
|
|
||||||
SetEnable (EV_BUTTON5, !g_bFullScreen && g_windowScale > 1);
|
SetEnable (EV_BUTTON5, !g_bFullScreen && g_zoom > 1);
|
||||||
SetEnable (EV_BUTTON6, !g_bFullScreen && g_windowScale < 2);
|
SetEnable (EV_BUTTON6, !g_bFullScreen && g_zoom < 2);
|
||||||
|
|
||||||
SetEnable (EV_BUTTON7, g_restoreMidi);
|
SetEnable (EV_BUTTON7, g_restoreMidi);
|
||||||
SetEnable (EV_BUTTON8, !g_restoreMidi);
|
SetEnable (EV_BUTTON8, !g_restoreMidi);
|
||||||
@ -2570,7 +2570,7 @@ CEvent::DrawButtons ()
|
|||||||
|
|
||||||
if (!g_bFullScreen)
|
if (!g_bFullScreen)
|
||||||
{
|
{
|
||||||
snprintf (res, sizeof (res), "%dx", g_windowScale);
|
snprintf (res, sizeof (res), "%dx", g_zoom);
|
||||||
lg = GetTextWidth (res);
|
lg = GetTextWidth (res);
|
||||||
pos.x = (284 + 40) - lg / 2;
|
pos.x = (284 + 40) - lg / 2;
|
||||||
pos.y = 330 - 20;
|
pos.y = 330 - 20;
|
||||||
@ -4114,18 +4114,18 @@ CEvent::ChangeButtons (Sint32 message)
|
|||||||
break;
|
break;
|
||||||
case EV_BUTTON5:
|
case EV_BUTTON5:
|
||||||
{
|
{
|
||||||
auto scale = g_windowScale;
|
auto scale = g_zoom;
|
||||||
if (g_windowScale > 1)
|
if (g_zoom > 1)
|
||||||
--g_windowScale;
|
--g_zoom;
|
||||||
SetWindowSize (scale, g_windowScale);
|
SetWindowSize (scale, g_zoom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EV_BUTTON6:
|
case EV_BUTTON6:
|
||||||
{
|
{
|
||||||
auto scale = g_windowScale;
|
auto scale = g_zoom;
|
||||||
if (g_windowScale < 2)
|
if (g_zoom < 2)
|
||||||
++g_windowScale;
|
++g_zoom;
|
||||||
SetWindowSize (scale, g_windowScale);
|
SetWindowSize (scale, g_zoom);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EV_BUTTON7:
|
case EV_BUTTON7:
|
||||||
@ -4710,7 +4710,7 @@ CEvent::WriteInfo ()
|
|||||||
: Language::undef);
|
: Language::undef);
|
||||||
info.musicMidi = g_restoreMidi;
|
info.musicMidi = g_restoreMidi;
|
||||||
info.fullScreen = g_bFullScreen;
|
info.fullScreen = g_bFullScreen;
|
||||||
info.zoom = g_windowScale;
|
info.zoom = g_zoom;
|
||||||
|
|
||||||
nb = fwrite (&info, sizeof (info), 1, file);
|
nb = fwrite (&info, sizeof (info), 1, file);
|
||||||
if (nb < 1)
|
if (nb < 1)
|
||||||
@ -4776,7 +4776,7 @@ CEvent::ReadInfo ()
|
|||||||
if (!(g_settingsOverload & SETTING_FULLSCREEN))
|
if (!(g_settingsOverload & SETTING_FULLSCREEN))
|
||||||
g_bFullScreen = !!info.fullScreen;
|
g_bFullScreen = !!info.fullScreen;
|
||||||
if (!(g_settingsOverload & SETTING_ZOOM))
|
if (!(g_settingsOverload & SETTING_ZOOM))
|
||||||
g_windowScale = info.zoom;
|
g_zoom = info.zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (file);
|
fclose (file);
|
||||||
@ -5154,8 +5154,7 @@ CEvent::DemoStep ()
|
|||||||
pos.y = event.motion.y;
|
pos.y = event.motion.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_WarpMouseInWindow (
|
SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom);
|
||||||
g_window, pos.x * g_windowScale, pos.y * g_windowScale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pDemoBuffer)
|
if (m_pDemoBuffer)
|
||||||
|
@ -142,8 +142,8 @@ public:
|
|||||||
|
|
||||||
void IntroStep ();
|
void IntroStep ();
|
||||||
|
|
||||||
void SetWindowSize (Uint8 newScale);
|
void SetWindowSize (Uint8 newScale);
|
||||||
void SetUpdateVersion (const std::string & version);
|
void SetUpdateVersion (const std::string & version);
|
||||||
|
|
||||||
static void PushUserEvent (Sint32 code, void * data = nullptr);
|
static void PushUserEvent (Sint32 code, void * data = nullptr);
|
||||||
|
|
||||||
|
@ -187,8 +187,7 @@ CMenu::Create (
|
|||||||
pos = m_pos;
|
pos = m_pos;
|
||||||
pos.x += DIMBUTTONX / 2;
|
pos.x += DIMBUTTONX / 2;
|
||||||
pos.y += DIMBUTTONY / 2;
|
pos.y += DIMBUTTONY / 2;
|
||||||
SDL_WarpMouseInWindow (
|
SDL_WarpMouseInWindow (g_window, pos.x * g_zoom, pos.y * g_zoom);
|
||||||
g_window, pos.x * g_windowScale, pos.y * g_windowScale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_selRank = Detect (pos);
|
m_selRank = Detect (pos);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user