|
|
|
|
@@ -7,8 +7,6 @@
|
|
|
|
|
#include "..\..\MultiplayerLocalPlayer.h"
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
#include "..\..\Windows64\KeyboardMouseInput.h"
|
|
|
|
|
|
|
|
|
|
extern HWND g_hWnd;
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
UIScene_AbstractContainerMenu::UIScene_AbstractContainerMenu(int iPad, UILayer *parentLayer) : UIScene(iPad, parentLayer)
|
|
|
|
|
@@ -30,12 +28,6 @@ UIScene_AbstractContainerMenu::UIScene_AbstractContainerMenu(int iPad, UILayer *
|
|
|
|
|
ui.OverrideSFX(m_iPad,ACTION_MENU_DOWN,true);
|
|
|
|
|
|
|
|
|
|
m_bIgnoreInput=false;
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
m_bMouseDragSlider = false;
|
|
|
|
|
m_bHasMousePosition = false;
|
|
|
|
|
m_lastMouseX = 0;
|
|
|
|
|
m_lastMouseY = 0;
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
UIScene_AbstractContainerMenu::~UIScene_AbstractContainerMenu()
|
|
|
|
|
@@ -92,8 +84,8 @@ void UIScene_AbstractContainerMenu::InitDataAssociations(int iPad, AbstractConta
|
|
|
|
|
void UIScene_AbstractContainerMenu::PlatformInitialize(int iPad, int startIndex)
|
|
|
|
|
{
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
g_KBMInput.SetScreenCursorHidden(false);
|
|
|
|
|
g_KBMInput.SetCursorHiddenForUI(false);
|
|
|
|
|
g_KBMInput.SetScreenCursorHidden(true);
|
|
|
|
|
g_KBMInput.SetCursorHiddenForUI(true);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
m_labelInventory.init( app.GetString(IDS_INVENTORY) );
|
|
|
|
|
@@ -214,144 +206,14 @@ void UIScene_AbstractContainerMenu::tick()
|
|
|
|
|
{
|
|
|
|
|
UIScene::tick();
|
|
|
|
|
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
bool mouseActive = (m_iPad == 0 && g_KBMInput.IsWindowFocused() && !g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive() && !g_KBMInput.IsCursorHiddenForUI());
|
|
|
|
|
bool drivePointerFromMouse = false;
|
|
|
|
|
float rawMouseMovieX = 0.0f;
|
|
|
|
|
float rawMouseMovieY = 0.0f;
|
|
|
|
|
int scrollDelta = 0;
|
|
|
|
|
|
|
|
|
|
if (mouseActive && g_hWnd)
|
|
|
|
|
{
|
|
|
|
|
RECT clientRect;
|
|
|
|
|
GetClientRect(g_hWnd, &clientRect);
|
|
|
|
|
int clientWidth = clientRect.right;
|
|
|
|
|
int clientHeight = clientRect.bottom;
|
|
|
|
|
if (clientWidth > 0 && clientHeight > 0)
|
|
|
|
|
{
|
|
|
|
|
int mouseX = g_KBMInput.GetMouseX();
|
|
|
|
|
int mouseY = g_KBMInput.GetMouseY();
|
|
|
|
|
bool mouseMoved = !m_bHasMousePosition || mouseX != m_lastMouseX || mouseY != m_lastMouseY;
|
|
|
|
|
|
|
|
|
|
m_bHasMousePosition = true;
|
|
|
|
|
m_lastMouseX = mouseX;
|
|
|
|
|
m_lastMouseY = mouseY;
|
|
|
|
|
scrollDelta = g_KBMInput.GetMouseWheel();
|
|
|
|
|
|
|
|
|
|
// Container coordinates are local to the main panel, so subtract its offset.
|
|
|
|
|
float mx = (float)mouseX * ((float)m_movieWidth / (float)clientWidth) - (float)m_controlMainPanel.getXPos();
|
|
|
|
|
float my = (float)mouseY * ((float)m_movieHeight / (float)clientHeight) - (float)m_controlMainPanel.getYPos();
|
|
|
|
|
|
|
|
|
|
rawMouseMovieX = mx;
|
|
|
|
|
rawMouseMovieY = my;
|
|
|
|
|
|
|
|
|
|
drivePointerFromMouse = m_bPointerDrivenByMouse || mouseMoved
|
|
|
|
|
|| g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT)
|
|
|
|
|
|| g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_RIGHT)
|
|
|
|
|
|| g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_MIDDLE)
|
|
|
|
|
|| scrollDelta != 0;
|
|
|
|
|
if (drivePointerFromMouse)
|
|
|
|
|
{
|
|
|
|
|
m_bPointerDrivenByMouse = true;
|
|
|
|
|
m_eCurrTapState = eTapStateNoInput;
|
|
|
|
|
m_pointerPos.x = mx;
|
|
|
|
|
m_pointerPos.y = my;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
onMouseTick();
|
|
|
|
|
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
if (mouseActive)
|
|
|
|
|
{
|
|
|
|
|
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT))
|
|
|
|
|
{
|
|
|
|
|
if (m_eCurrSection == eSectionInventoryCreativeSlider)
|
|
|
|
|
{
|
|
|
|
|
m_bMouseDragSlider = true;
|
|
|
|
|
m_pointerPos.x = rawMouseMovieX;
|
|
|
|
|
m_pointerPos.y = rawMouseMovieY;
|
|
|
|
|
handleOtherClicked(m_iPad, eSectionInventoryCreativeSlider, 0, false);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_A, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (m_bMouseDragSlider && g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT))
|
|
|
|
|
{
|
|
|
|
|
m_pointerPos.x = rawMouseMovieX;
|
|
|
|
|
m_pointerPos.y = rawMouseMovieY;
|
|
|
|
|
handleOtherClicked(m_iPad, eSectionInventoryCreativeSlider, 0, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!g_KBMInput.IsMouseButtonDown(KeyboardMouseInput::MOUSE_LEFT))
|
|
|
|
|
m_bMouseDragSlider = false;
|
|
|
|
|
|
|
|
|
|
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_RIGHT))
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_X, false);
|
|
|
|
|
}
|
|
|
|
|
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_MIDDLE))
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_Y, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (scrollDelta > 0)
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_OTHER_STICK_UP, false);
|
|
|
|
|
}
|
|
|
|
|
else if (scrollDelta < 0)
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_OTHER_STICK_DOWN, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (g_KBMInput.IsKeyPressed(VK_ESCAPE))
|
|
|
|
|
{
|
|
|
|
|
handleKeyDown(m_iPad, ACTION_MENU_B, false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
IggyEvent mouseEvent;
|
|
|
|
|
S32 width, height;
|
|
|
|
|
m_parentLayer->getRenderDimensions(width, height);
|
|
|
|
|
|
|
|
|
|
#ifdef _WINDOWS64
|
|
|
|
|
S32 x;
|
|
|
|
|
S32 y;
|
|
|
|
|
if (mouseActive && m_bPointerDrivenByMouse && g_hWnd)
|
|
|
|
|
{
|
|
|
|
|
RECT clientRect;
|
|
|
|
|
GetClientRect(g_hWnd, &clientRect);
|
|
|
|
|
if (clientRect.right > 0 && clientRect.bottom > 0)
|
|
|
|
|
{
|
|
|
|
|
float mouseMovieX = (float)g_KBMInput.GetMouseX() * ((float)m_movieWidth / (float)clientRect.right);
|
|
|
|
|
float mouseMovieY = (float)g_KBMInput.GetMouseY() * ((float)m_movieHeight / (float)clientRect.bottom);
|
|
|
|
|
float mouseLocalX = mouseMovieX - (float)m_controlMainPanel.getXPos();
|
|
|
|
|
float mouseLocalY = mouseMovieY - (float)m_controlMainPanel.getYPos();
|
|
|
|
|
|
|
|
|
|
x = (S32)(mouseLocalX * ((float)width / m_movieWidth));
|
|
|
|
|
y = (S32)(mouseLocalY * ((float)height / m_movieHeight));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth));
|
|
|
|
|
y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth));
|
|
|
|
|
y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight));
|
|
|
|
|
}
|
|
|
|
|
#else
|
|
|
|
|
S32 x = (S32)(m_pointerPos.x * ((float)width / m_movieWidth));
|
|
|
|
|
S32 y = (S32)(m_pointerPos.y * ((float)height / m_movieHeight));
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
IggyMakeEventMouseMove( &mouseEvent, x, y);
|
|
|
|
|
|
|
|
|
|
|