added zoom with F

This commit is contained in:
retuci0 2026-03-17 08:55:06 +01:00
parent 5a59f5d146
commit 3bb147aad6
3 changed files with 28 additions and 9 deletions

View file

@ -578,17 +578,21 @@ void GameRenderer::moveCameraToPlayer(float a)
}
// fixed - retucio
void GameRenderer::zoomRegion(double zoom, double xa, double ya) {
// clamp zoom to reasonable range to avoid degenerate matrices
if (zoom < 0.1) zoom = 0.1;
if (zoom > 10.0) zoom = 10.0;
void GameRenderer::zoomRegion(double zoom, double xa, double ya)
{
zoom = zoom;
zoom_x = xa;
zoom_y = ya;
this->zoom = zoom;
this->zoom_x = xa;
this->zoom_y = ya;
}
void GameRenderer::unZoomRegion()
{
zoom = 1;
void GameRenderer::unZoomRegion() {
this->zoom = 1.0;
this->zoom_x = 0.0;
this->zoom_y = 0.0;
}
// 4J added as we have more complex adjustments to make for fov & aspect on account of viewports
@ -2249,4 +2253,4 @@ int GameRenderer::getFpsCap(int option)
void GameRenderer::updateAllChunks()
{
// mc->levelRenderer->updateDirtyChunks(mc->cameraTargetPlayer, true);
}
}

View file

@ -26,6 +26,7 @@ public:
static const int KEY_CRAFTING = 'C';
static const int KEY_CRAFTING_ALT = 'R';
static const int KEY_CHAT = 'T';
static const int KEY_ZOOM = 'F';
static const int KEY_CONFIRM = VK_RETURN;
static const int KEY_CANCEL = VK_ESCAPE;
static const int KEY_PAUSE = VK_ESCAPE;

View file

@ -562,6 +562,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
vk = (lParam & (1 << 24)) ? VK_RCONTROL : VK_LCONTROL;
else if (vk == VK_MENU)
vk = (lParam & (1 << 24)) ? VK_RMENU : VK_LMENU;
g_KBMInput.OnKeyDown(vk);
return DefWindowProc(hWnd, message, wParam, lParam);
}
@ -1821,6 +1822,19 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
SetFocus(g_hWnd);
}
// zoom with F - retucio
if (!ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL) {
Minecraft* mc = Minecraft::GetInstance();
if (mc && mc->gameRenderer) {
if (g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_ZOOM)) {
mc->gameRenderer->zoomRegion(5.0, 0.0, 0.0);
} else {
mc->gameRenderer->unZoomRegion();
}
}
}
#if 0
// has the game defined profile data been changed (by a profile load)
if(app.uiGameDefinedDataChangedBitmask!=0)