Skip to content

Commit c1c13b1

Browse files
committed
Add zooming for debug purposes (is fun tho might keep)
1 parent cf16edd commit c1c13b1

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

Source/Managers/FrameMan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -832,7 +832,7 @@ void FrameMan::Draw() {
832832
rlSetBlendMode(RL_BLEND_ALPHA);
833833
rlEnableDepthTest();
834834

835-
m_PlayerScreen->Begin(true);
835+
m_PlayerScreen->Begin(true, m_Zoom);
836836
backgroundShader.Begin();
837837
backgroundShader.Enable();
838838
rlSetUniformSampler(backgroundShader.GetUniformLocation("rtePalette"), g_PostProcessMan.GetPaletteTexture());

Source/Managers/FrameMan.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,9 @@ namespace RTE {
251251
/// @param screenId The screen to set for.
252252
void SetHudDisabled(bool value, int screenId = 0) { m_HUDDisabled[screenId] = value; }
253253

254+
float GetZoom() {return m_Zoom;}
255+
void SetZoom(float zoom) {m_Zoom = zoom;}
256+
254257
#pragma region Network Handling
255258
/// Returns true if this manager is in multiplayer mode, storing the 8bpp backbuffer for network transmission.
256259
/// @return True if in multiplayer mode.
@@ -441,6 +444,7 @@ namespace RTE {
441444
std::unique_ptr<BITMAP, BitmapDeleter> m_NetworkBackBufferFinalGUI8[2][c_MaxScreenCount]; //!< Per-player allocated frame buffer to copy Intermediate before sending. Used to draw UI only.
442445

443446
std::shared_ptr<RenderTarget> m_BackBuffer; //!< Main render backbuffer.
447+
float m_Zoom{1.0f};
444448

445449
Vector m_TargetPos[2][c_MaxScreenCount]; //!< Frame target position for network players.
446450

Source/Managers/PostProcessMan.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,8 @@ void PostProcessMan::PostProcess() {
363363
rlEnableColorBlend();
364364
rlSetBlendFactorsSeparate(GL_ONE, GL_ONE_MINUS_SRC_COLOR, GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_FUNC_ADD, GL_FUNC_ADD);
365365
rlSetBlendMode(RL_BLEND_CUSTOM_SEPARATE);
366+
m_PostProcessFramebuffer->End();
367+
m_PostProcessFramebuffer->Begin(false, g_FrameMan.GetZoom());
366368

367369
m_PostProcessShader->Begin();
368370

Source/Managers/UInputMan.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -914,6 +914,12 @@ void UInputMan::HandleSpecialInput() {
914914
if (KeyPressed(SDLK_p)) {
915915
g_PerformanceMan.ShowAdvancedPerformanceStats(!g_PerformanceMan.AdvancedPerformanceStatsEnabled());
916916
}
917+
} else if (KeyPressed(SDLK_PLUS)) {
918+
g_FrameMan.SetZoom(g_FrameMan.GetZoom() + 0.1f);
919+
} else if (KeyPressed(SDLK_MINUS)) {
920+
g_FrameMan.SetZoom(g_FrameMan.GetZoom() - 0.1f);
921+
} else if (KeyPressed(SDLK_EQUALS)) {
922+
g_FrameMan.SetZoom(1.0f);
917923
}
918924
} else {
919925
if (KeyPressed(SDLK_F1)) {

0 commit comments

Comments
 (0)