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:
@@ -878,7 +878,8 @@ enum EControllerActions
|
|||||||
MINECRAFT_ACTION_SPAWN_CREEPER,
|
MINECRAFT_ACTION_SPAWN_CREEPER,
|
||||||
MINECRAFT_ACTION_CHANGE_SKIN,
|
MINECRAFT_ACTION_CHANGE_SKIN,
|
||||||
MINECRAFT_ACTION_FLY_TOGGLE,
|
MINECRAFT_ACTION_FLY_TOGGLE,
|
||||||
MINECRAFT_ACTION_RENDER_DEBUG
|
MINECRAFT_ACTION_RENDER_DEBUG,
|
||||||
|
MINECRAFT_ACTION_SCREENSHOT
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eMCLang
|
enum eMCLang
|
||||||
|
|||||||
@@ -1553,6 +1553,9 @@ void Minecraft::run_middle()
|
|||||||
localplayers[i]->ullButtonsPressed|=1LL<<MINECRAFT_ACTION_RENDER_DEBUG;
|
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
|
// In flying mode, Shift held = sneak/descend
|
||||||
if(g_KBMInput.IsKBMActive() && g_KBMInput.IsKeyDown(KeyboardMouseInput::KEY_SNEAK))
|
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;
|
//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))
|
if((player->ullButtonsPressed&(1LL<<MINECRAFT_ACTION_GAME_INFO)) && gameMode->isInputAllowed(MINECRAFT_ACTION_GAME_INFO))
|
||||||
{
|
{
|
||||||
ui.NavigateToScene(iPad,eUIScene_InGameInfoMenu);
|
ui.NavigateToScene(iPad,eUIScene_InGameInfoMenu);
|
||||||
|
|||||||
@@ -36,8 +36,6 @@ public:
|
|||||||
static const int KEY_DEBUG_CONSOLE = VK_F6;
|
static const int KEY_DEBUG_CONSOLE = VK_F6;
|
||||||
static const int KEY_HOST_SETTINGS = VK_TAB;
|
static const int KEY_HOST_SETTINGS = VK_TAB;
|
||||||
static const int KEY_FULLSCREEN = VK_F11;
|
static const int KEY_FULLSCREEN = VK_F11;
|
||||||
|
|
||||||
// todo: implement and shi
|
|
||||||
static const int KEY_SCREENSHOT = VK_F2;
|
static const int KEY_SCREENSHOT = VK_F2;
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
|||||||
Reference in New Issue
Block a user