mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Disable input instead of showing an empty gui
This commit is contained in:
parent
2dbb5eea02
commit
2ae2d9ff1b
|
|
@ -2257,6 +2257,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
int iPad=player->GetXboxPad();
|
||||
//OutputDebugString("Minecraft::tick\n");
|
||||
|
||||
|
||||
//4J-PB - only tick this player's stats
|
||||
stats[iPad]->tick(iPad);
|
||||
|
||||
|
|
@ -2305,6 +2306,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
* progressRenderer.progressStagePercentage(0); } else {
|
||||
* serverConnection.tick(); serverConnection.sendPosition(player); } }
|
||||
*/
|
||||
|
||||
if (screen == NULL && player != NULL )
|
||||
{
|
||||
if (player->getHealth() <= 0 && !ui.GetMenuDisplayed(iPad) )
|
||||
|
|
@ -2313,7 +2315,7 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
}
|
||||
else if (player->isSleeping() && level != NULL && level->isClientSide)
|
||||
{
|
||||
// setScreen(new InBedChatScreen()); // 4J - TODO put back in
|
||||
//setScreen(new InBedChatScreen()); // 4J - TODO put back in
|
||||
}
|
||||
}
|
||||
else if (screen != NULL && (dynamic_cast<InBedChatScreen *>(screen)!=NULL) && !player->isSleeping())
|
||||
|
|
@ -2350,7 +2352,11 @@ void Minecraft::tick(bool bFirst, bool bUpdateTextures)
|
|||
#ifdef _WINDOWS64
|
||||
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused())
|
||||
{
|
||||
g_KBMInput.SetMouseGrabbed(true);
|
||||
g_KBMInput.SetMouseGrabbed(false);
|
||||
}
|
||||
|
||||
if (screen == NULL && !g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsWindowFocused()) {
|
||||
g_KBMInput.SetMouseGrabbed(true);
|
||||
}
|
||||
#endif
|
||||
// 4J-PB - add some tooltips if required
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ void KeyboardMouseInput::Init()
|
|||
m_mouseWheelAccum = 0;
|
||||
m_mouseWheelConsumed = false;
|
||||
m_mouseGrabbed = false;
|
||||
m_mouseActive = true;
|
||||
m_cursorHiddenForUI = false;
|
||||
m_windowFocused = true;
|
||||
m_hasInput = false;
|
||||
|
|
@ -200,10 +201,15 @@ int KeyboardMouseInput::GetMouseWheel()
|
|||
|
||||
void KeyboardMouseInput::OnRawMouseDelta(int dx, int dy)
|
||||
{
|
||||
if (!m_mouseActive)
|
||||
return;
|
||||
|
||||
m_mouseDeltaAccumX += dx;
|
||||
m_mouseDeltaAccumY += dy;
|
||||
}
|
||||
|
||||
|
||||
|
||||
bool KeyboardMouseInput::IsKeyDown(int vkCode) const
|
||||
{
|
||||
if (vkCode == VK_SHIFT || vkCode == VK_CONTROL || vkCode == VK_MENU)
|
||||
|
|
|
|||
|
|
@ -84,6 +84,9 @@ public:
|
|||
void SetScreenCursorHidden(bool hidden) { m_screenWantsCursorHidden = hidden; }
|
||||
bool IsScreenCursorHidden() const { return m_screenWantsCursorHidden; }
|
||||
|
||||
void SetActiveMouse(bool active) { m_mouseActive = active; }
|
||||
bool IsActiveMouse() { return m_mouseActive; }
|
||||
|
||||
// Text input: buffer characters typed while the native keyboard scene is open
|
||||
void OnChar(wchar_t c);
|
||||
bool ConsumeChar(wchar_t &outChar);
|
||||
|
|
@ -133,6 +136,8 @@ private:
|
|||
|
||||
bool m_kbmActive;
|
||||
|
||||
bool m_mouseActive;
|
||||
|
||||
bool m_screenWantsCursorHidden;
|
||||
|
||||
static const int CHAR_BUFFER_SIZE = 32;
|
||||
|
|
|
|||
|
|
@ -368,13 +368,6 @@ void Player::tick()
|
|||
foodData.tick(dynamic_pointer_cast<Player>(shared_from_this()));
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (g_KBMInput.IsKeyDown(VK_LSHIFT) && this->isSleeping())
|
||||
{
|
||||
stopSleepInBed(true, true, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
// 4J Stu Debugging
|
||||
if (!level->isClientSide)
|
||||
{
|
||||
|
|
@ -1865,10 +1858,7 @@ Player::BedSleepingResult Player::startSleepInBed(int x, int y, int z, bool bTes
|
|||
setPos(x + .5f, y + 15.0f / 16.0f, z + .5f);
|
||||
}
|
||||
m_isSleeping = true;
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
Minecraft::GetInstance()->setScreen(new Screen());
|
||||
#endif
|
||||
g_KBMInput.SetActiveMouse(false);
|
||||
|
||||
sleepCounter = 0;
|
||||
bedPosition = new Pos(x, y, z);
|
||||
|
|
@ -1940,6 +1930,8 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save
|
|||
}
|
||||
|
||||
m_isSleeping = false;
|
||||
g_KBMInput.SetActiveMouse(true);
|
||||
|
||||
if (!level->isClientSide && updateLevelList)
|
||||
{
|
||||
level->updateSleepingPlayerList();
|
||||
|
|
@ -1956,10 +1948,6 @@ void Player::stopSleepInBed(bool forcefulWakeUp, bool updateLevelList, bool save
|
|||
{
|
||||
setRespawnPosition(bedPosition, false);
|
||||
}
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
Minecraft::GetInstance()->setScreen(nullptr);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue