forked from cafeberry/cafeberry
copy and paste again :3
This commit is contained in:
@@ -868,6 +868,9 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// Set the number of possible joypad layouts that the user can switch between, and the number of actions
|
||||
InputManager.Initialise(1,3,MINECRAFT_ACTION_MAX, ACTION_MAX_MENU);
|
||||
|
||||
//univ - thank you smartcmd :3
|
||||
g_KBMInput.Init();
|
||||
|
||||
// Set the default joypad action mappings for Minecraft
|
||||
DefineActions();
|
||||
InputManager.SetJoypadMapVal(0,0);
|
||||
@@ -928,6 +931,8 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
MSG msg = {0};
|
||||
while( WM_QUIT != msg.message )
|
||||
{
|
||||
g_KBMInput.Tick();
|
||||
|
||||
if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
|
||||
{
|
||||
TranslateMessage( &msg );
|
||||
@@ -959,8 +964,17 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
g_KBMInput.SetKBMActive(true);
|
||||
//if (ui.FindScene(eUIScene_BookMenu) != nullptr) ui.FindScene(eUIScene_BookMenu)->KBMUpdate(true);
|
||||
}
|
||||
} else
|
||||
g_KBMInput.SetKBMActive(true);
|
||||
|
||||
if (!g_KBMInput.IsMouseGrabbed())
|
||||
{
|
||||
if (!g_KBMInput.IsKBMActive())
|
||||
g_KBMInput.SetCursorHiddenForUI(true);
|
||||
else if (!g_KBMInput.IsScreenCursorHidden())
|
||||
g_KBMInput.SetCursorHiddenForUI(false);
|
||||
}
|
||||
|
||||
|
||||
PIXEndNamedEvent();
|
||||
/*PIXBeginNamedEvent(0,"Profile manager tick");
|
||||
ProfileManager.Tick();
|
||||
@@ -980,6 +994,7 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
// Render game graphics.
|
||||
if(app.GetGameStarted())
|
||||
{
|
||||
pMinecraft->applyFrameMouseLook();
|
||||
pMinecraft->run_middle();
|
||||
app.SetAppPaused( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()) );
|
||||
}
|
||||
@@ -1009,6 +1024,35 @@ int APIENTRY _tWinMain(_In_ HINSTANCE hInstance,
|
||||
|
||||
ui.CheckMenuDisplayed();
|
||||
|
||||
// Update mouse grab: grab when in-game and no menu is open
|
||||
{
|
||||
static bool altToggleSuppressCapture = false;
|
||||
const bool shouldCapture = app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == nullptr;
|
||||
// Left Alt key toggles capture on/off for debugging
|
||||
if (g_KBMInput.IsKeyPressed(VK_LMENU) || g_KBMInput.IsKeyPressed(VK_RMENU))
|
||||
{
|
||||
if (g_KBMInput.IsMouseGrabbed()) { g_KBMInput.SetMouseGrabbed(false); altToggleSuppressCapture = true; }
|
||||
else if (shouldCapture) { g_KBMInput.SetMouseGrabbed(true); altToggleSuppressCapture = false; }
|
||||
}
|
||||
else if (!shouldCapture)
|
||||
{
|
||||
if (g_KBMInput.IsMouseGrabbed()) g_KBMInput.SetMouseGrabbed(false);
|
||||
altToggleSuppressCapture = false;
|
||||
}
|
||||
else if (shouldCapture && !g_KBMInput.IsMouseGrabbed() && GetFocus() == g_hWnd && !altToggleSuppressCapture)
|
||||
{
|
||||
g_KBMInput.SetMouseGrabbed(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Open chat
|
||||
if (g_KBMInput.IsKeyPressed(KeyboardMouseInput::KEY_CHAT) && app.GetGameStarted() && !ui.GetMenuDisplayed(0) && pMinecraft->screen == NULL)
|
||||
{
|
||||
g_KBMInput.ClearCharBuffer();
|
||||
pMinecraft->setScreen(new ChatScreen());
|
||||
SetFocus(g_hWnd);
|
||||
}
|
||||
|
||||
// Any threading type things to deal with from the xui side?
|
||||
app.HandleXuiActions();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user