mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-10-22 19:22:04 +00:00
Mouse hover and click in split-screen was broken: the coordinate conversion from window pixels to Flash/SWF space did not account for the viewport tile-origin offset or the smaller display dimensions of each splitscreen quadrant. Now the mouse position is mapped through three steps: window pixels to UIController screen space, subtract the viewport origin (which varies per quadrant/split type), then scale from display size to SWF authoring size. This fixes hover highlighting and click targeting in all splitscreen layouts. Mouse input was also bleeding into other splitscreen players' UI groups because the scene lookup iterated all groups. Now it only checks the fullscreen group and the primary (KBM) player's group, so controller players' menus are never affected by mouse movement. Mouse grab/release (cursor lock for gameplay) was triggering for every local player's tick, causing fights between splitscreen players over the cursor state. Now only the primary pad player controls grab state. The in-game keyboard scene in PC mode had no cursor movement: typing always appended at the end and backspace always deleted from the end. Added a cursor position tracker (m_iCursorPos) so that characters are inserted at the cursor, backspace deletes behind it, and arrow keys, Home, End, and Delete all work as expected. The Flash caret is synced to the cursor position each tick. Also stopped syncing the text buffer back from Flash in PC mode, which was resetting the cursor every tick. Arrow keys in PC mode no longer get forwarded to Flash (which would move the on-screen keyboard selector instead of the text cursor). AddLocalPlayerByUserIndex was calling NotifyPlayerJoined before the IQNet slot was actually registered, passing a pointer obtained via GetLocalPlayerByUserIndex which checks customData (not set yet at that point). Now AddLocalPlayerByUserIndex is called first, and if it succeeds, the notification uses the static m_player array directly. The stub AddLocalPlayerByUserIndex now properly initialises the slot with gamertag and remote/host flags instead of being a no-op. IsSignedIn was hardcoded to return true only for pad 0, preventing splitscreen players from joining. Now it checks IsPadConnected so any connected controller can sign in. GetXUID returned INVALID_XUID for all pads except 0, which broke splitscreen player identity. Now each pad gets a unique XUID derived from the base value plus the pad index. Pinned internal resolution to 1920x1080 and removed GetSystemMetrics auto-detection which was picking up the native monitor resolution and breaking the 16:9 assumption in the viewport math and Flash layout. DPI awareness is kept for consistent pixel coordinates.
96 lines
3.1 KiB
C++
96 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include "UIScene.h"
|
|
|
|
class UIScene_Keyboard : public UIScene
|
|
{
|
|
private:
|
|
bool m_bKeyboardDonePressed;
|
|
|
|
#ifdef _WINDOWS64
|
|
int(*m_win64Callback)(LPVOID, const bool);
|
|
LPVOID m_win64CallbackParam;
|
|
wstring m_win64TextBuffer;
|
|
int m_win64MaxChars;
|
|
bool m_bPCMode; // Hides on-screen keyboard buttons; physical keyboard only
|
|
int m_iCursorPos;
|
|
#endif
|
|
|
|
protected:
|
|
UIControl_Label m_EnterTextLabel;
|
|
UIControl_TextInput m_KeyboardTextInput;
|
|
UIControl_Button m_ButtonSpace, m_ButtonCursorLeft, m_ButtonCursorRight, m_ButtonCaps, m_ButtonDone, m_ButtonSymbols, m_ButtonBackspace;
|
|
|
|
IggyName m_funcInitFunctionButtons;
|
|
IggyName m_funcCursorRightButtonPressed, m_funcCursorLeftButtonPressed, m_funcCapsButtonPressed, m_funcBackspaceButtonPressed;
|
|
IggyName m_funcSpaceButtonPressed, m_funcSymbolButtonPressed, m_funcDoneButtonPressed;
|
|
|
|
UI_BEGIN_MAP_ELEMENTS_AND_NAMES(UIScene)
|
|
UI_MAP_ELEMENT(m_EnterTextLabel, "EnterTextLabel")
|
|
UI_MAP_ELEMENT(m_KeyboardTextInput, "KeyboardTextInput")
|
|
|
|
UI_MAP_ELEMENT(m_ButtonSpace, "Button_space")
|
|
UI_MAP_ELEMENT(m_ButtonCursorLeft, "Button_CursorLeft")
|
|
UI_MAP_ELEMENT(m_ButtonCursorRight, "Button_CursorRight")
|
|
UI_MAP_ELEMENT(m_ButtonCaps, "Button_Caps")
|
|
UI_MAP_ELEMENT(m_ButtonDone, "Button_Done")
|
|
UI_MAP_ELEMENT(m_ButtonSymbols, "Button_symbols")
|
|
UI_MAP_ELEMENT(m_ButtonBackspace, "Button_bspace")
|
|
|
|
UI_MAP_NAME(m_funcInitFunctionButtons, L"InitFunctionButtons");
|
|
|
|
UI_MAP_NAME(m_funcCursorRightButtonPressed, L"CursorRightButtonPressed");
|
|
UI_MAP_NAME(m_funcCursorLeftButtonPressed, L"CursorLeftButtonPressed");
|
|
UI_MAP_NAME(m_funcCapsButtonPressed, L"CapsButtonPressed");
|
|
UI_MAP_NAME(m_funcBackspaceButtonPressed, L"BackspaceButtonPressed");
|
|
UI_MAP_NAME(m_funcSpaceButtonPressed, L"SpaceButtonPressed");
|
|
UI_MAP_NAME(m_funcSymbolButtonPressed, L"SymbolButtonPressed");
|
|
UI_MAP_NAME(m_funcDoneButtonPressed, L"DoneButtonPressed");
|
|
UI_END_MAP_ELEMENTS_AND_NAMES()
|
|
|
|
public:
|
|
UIScene_Keyboard(int iPad, void *initData, UILayer *parentLayer);
|
|
~UIScene_Keyboard();
|
|
|
|
virtual void updateTooltips();
|
|
|
|
virtual bool allowRepeat(int key);
|
|
// INPUT
|
|
virtual void handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled);
|
|
|
|
#ifdef _WINDOWS64
|
|
virtual void tick();
|
|
#endif
|
|
|
|
virtual void handleTimerComplete(int id);
|
|
|
|
protected:
|
|
void handlePress(F64 controlId, F64 childId);
|
|
|
|
protected:
|
|
// TODO: This should be pure virtual in this class
|
|
virtual wstring getMoviePath();
|
|
|
|
private:
|
|
void KeyboardDonePressed();
|
|
|
|
public:
|
|
virtual EUIScene getSceneType() { return eUIScene_Keyboard;}
|
|
|
|
// Returns true if this scene handles input
|
|
//virtual bool stealsFocus() { return false; }
|
|
|
|
// Returns true if this scene has focus for the pad passed in
|
|
//virtual bool hasFocus(int iPad) { return false; }
|
|
// Returns true if this scene has focus for the pad passed in
|
|
#ifndef __PS3__
|
|
virtual bool hasFocus(int iPad) { return bHasFocus; }
|
|
#endif
|
|
|
|
// Returns true if lower scenes in this scenes layer, or in any layer below this scenes layers should be hidden
|
|
#ifdef _WINDOWS64
|
|
virtual bool hidesLowerScenes() { return true; }
|
|
#else
|
|
virtual bool hidesLowerScenes() { return false; }
|
|
#endif
|
|
}; |