mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Merge branch 'main' into main
This commit is contained in:
commit
b87774ab33
|
|
@ -481,7 +481,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||
#endif
|
||||
|
||||
#ifdef _WINDOWS64
|
||||
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive() && g_KBMInput.IsCursorHiddenForUI())
|
||||
if (!g_KBMInput.IsMouseGrabbed() && g_KBMInput.IsKBMActive())
|
||||
{
|
||||
int deltaX = g_KBMInput.GetMouseDeltaX();
|
||||
int deltaY = g_KBMInput.GetMouseDeltaY();
|
||||
|
|
|
|||
|
|
@ -28,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()
|
||||
|
|
@ -90,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) );
|
||||
|
|
@ -212,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);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,6 @@ class UIScene_AbstractContainerMenu : public UIScene, public virtual IUIScene_Ab
|
|||
private:
|
||||
ESceneSection m_focusSection;
|
||||
bool m_bIgnoreInput;
|
||||
#ifdef _WINDOWS64
|
||||
bool m_bMouseDragSlider;
|
||||
bool m_bHasMousePosition;
|
||||
int m_lastMouseX;
|
||||
int m_lastMouseY;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
UIControl m_controlMainPanel;
|
||||
|
|
|
|||
|
|
@ -973,6 +973,9 @@ void gdraw_D3D1X_(SetRendertargetSize)(S32 w, S32 h)
|
|||
|
||||
void gdraw_D3D1X_(SetTileOrigin)(ID3D1X(RenderTargetView) *main_rt, ID3D1X(DepthStencilView) *main_ds, ID3D1X(ShaderResourceView) *non_msaa_rt, S32 x, S32 y)
|
||||
{
|
||||
|
||||
if (!gdraw) return; // AAR - saftey check because windows calls resize early
|
||||
|
||||
D3D1X_(RENDER_TARGET_VIEW_DESC) desc;
|
||||
|
||||
if (gdraw->frame_done) {
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ void KeyboardMouseInput::Tick()
|
|||
}
|
||||
}
|
||||
|
||||
if (m_windowFocused && (m_mouseGrabbed || m_cursorHiddenForUI) && g_hWnd)
|
||||
if ((m_mouseGrabbed || m_cursorHiddenForUI) && g_hWnd)
|
||||
{
|
||||
RECT rc;
|
||||
GetClientRect(g_hWnd, &rc);
|
||||
|
|
|
|||
|
|
@ -88,8 +88,7 @@ BOOL g_bWidescreen = TRUE;
|
|||
int g_iScreenWidth = 1920;
|
||||
int g_iScreenHeight = 1080;
|
||||
|
||||
UINT g_ScreenWidth = 1920;
|
||||
UINT g_ScreenHeight = 1080;
|
||||
float g_iAspectRatio = static_cast<float>(g_iScreenWidth) / g_iScreenHeight;
|
||||
|
||||
char g_Win64Username[17] = { 0 };
|
||||
wchar_t g_Win64UsernameW[17] = { 0 };
|
||||
|
|
@ -98,6 +97,14 @@ wchar_t g_Win64UsernameW[17] = { 0 };
|
|||
static bool g_isFullscreen = false;
|
||||
static WINDOWPLACEMENT g_wpPrev = { sizeof(g_wpPrev) };
|
||||
|
||||
//--------------------------------------------------------------------------------------
|
||||
// Update the Aspect Ratio to support Any Aspect Ratio
|
||||
//--------------------------------------------------------------------------------------
|
||||
void UpdateAspectRatio(int width, int height)
|
||||
{
|
||||
g_iAspectRatio = static_cast<float>(width) / height;
|
||||
}
|
||||
|
||||
struct Win64LaunchOptions
|
||||
{
|
||||
int screenMode;
|
||||
|
|
@ -468,6 +475,7 @@ ID3D11Texture2D* g_pDepthStencilBuffer = NULL;
|
|||
// WM_COMMAND - process the application menu
|
||||
// WM_PAINT - Paint the main window
|
||||
// WM_DESTROY - post a quit message and return
|
||||
// WM_SIZE - handle resizing logic to support Any Aspect Ratio
|
||||
//
|
||||
//
|
||||
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
|
|
@ -585,6 +593,11 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
}
|
||||
}
|
||||
break;
|
||||
case WM_SIZE:
|
||||
{
|
||||
UpdateAspectRatio(LOWORD(lParam), HIWORD(lParam));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return DefWindowProc(hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
|
@ -719,7 +732,7 @@ HRESULT InitDevice()
|
|||
//app.DebugPrintf("width: %d, height: %d\n", width, height);
|
||||
width = g_iScreenWidth;
|
||||
height = g_iScreenHeight;
|
||||
app.DebugPrintf("width: %d, height: %d\n", width, height);
|
||||
//app.DebugPrintf("width: %d, height: %d\n", width, height);
|
||||
|
||||
UINT createDeviceFlags = 0;
|
||||
#ifdef _DEBUG
|
||||
|
|
|
|||
|
|
@ -48,13 +48,11 @@ void glLoadIdentity()
|
|||
RenderManager.MatrixSetIdentity();
|
||||
}
|
||||
|
||||
extern int g_iScreenWidth;
|
||||
extern int g_iScreenHeight;
|
||||
|
||||
// AAR - Use calculated aspect ratio to support dynamic resizing
|
||||
extern float g_iAspectRatio;
|
||||
void gluPerspective(float fovy, float aspect, float zNear, float zFar)
|
||||
{
|
||||
float dynamicAspect = (float)g_iScreenWidth / (float)g_iScreenHeight;
|
||||
RenderManager.MatrixPerspective(fovy, dynamicAspect, zNear, zFar);
|
||||
RenderManager.MatrixPerspective(fovy, g_iAspectRatio, zNear, zFar);
|
||||
}
|
||||
|
||||
void glOrtho(float left,float right,float bottom,float top,float zNear,float zFar)
|
||||
|
|
|
|||
Loading…
Reference in a new issue