Add F2 screenshot functionality (#1262)

- Updated `EControllerActions` to include `MINECRAFT_ACTION_SCREENSHOT`.
- Added conditional compilation for `stb_image_write.h` in `Minecraft.cpp`.
- Modified `run_middle()` to handle screenshot key press.
- Updated `tick()` to capture and save screenshots as PNG files.
- Introduced `KEY_SCREENSHOT` in `KeyboardMouseInput.h` mapped to F2.
- Added `stb_image_write.h` for image writing capabilities.
This commit is contained in:
Revela 2026-04-16 22:33:30 -05:00 committed by GitHub
parent 78d4bc80cf
commit d0094a6409
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 3 deletions

View file

@ -1553,6 +1553,9 @@ void Minecraft::run_middle()
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_DEBUG;
}
if(g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_SCREENSHOT))
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_SCREENSHOT;
// In flying mode, Shift held = sneak/descend
if(g_KBMInput.IsKBMActive() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SNEAK))
{
@ -3741,6 +3744,13 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
//options->thirdPersonView = !options->thirdPersonView;
}
#ifdef _WINDOWS64
if(player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_SCREENSHOT))
{
RenderManager.DoScreenGrabOnNextPresent();
}
#endif
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_GAME_INFO)) && gameMode->isInputAllowed(MINECRAFT_ACTION_GAME_INFO))
{
ui.NavigateToScene(iPad,eUIScene_InGameInfoMenu);