mirror of
https://github.com/GabsPuNs/Project-Zenith-Main.git
synced 2026-07-09 23:38:09 +00:00
Merge branch 'TU30-RMLUI' into TU30-RMLUI
This commit is contained in:
@@ -69,6 +69,91 @@ UIScene_PauseMenu::~UIScene_PauseMenu()
|
||||
m_parentLayer->showComponent(m_iPad, eUIComponent_Logo, false);
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::gainFocus()
|
||||
{
|
||||
if (!bHasFocus && stealsFocus())
|
||||
{
|
||||
bHasFocus = true;
|
||||
updateTooltips();
|
||||
updateComponents();
|
||||
|
||||
if (!m_bFocussedOnce)
|
||||
// No Iggy set-focus call needed for RmlUi scene
|
||||
|
||||
handleGainFocus(m_bFocussedOnce);
|
||||
|
||||
if (bHasFocus)
|
||||
m_bFocussedOnce = true;
|
||||
|
||||
if (m_document)
|
||||
m_document->Show();
|
||||
}
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::handleLoseFocus()
|
||||
{
|
||||
if (m_document)
|
||||
m_document->Hide();
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::reloadMovie(bool force)
|
||||
{
|
||||
}
|
||||
|
||||
//GabsPuN: When Iggy is completely replaced, some functions should be moved to UIScene.cpp.
|
||||
//This way, the tick() function won't be repeated in every UIScene_ cpp file.
|
||||
//Also, since iggy no longer exists, we can take liberties with optimization or code
|
||||
//that is easier to work with.
|
||||
void UIScene_PauseMenu::tick()
|
||||
{
|
||||
// Signal the base class that we've ticked once, so it sets m_bCanHandleInput
|
||||
// (the Iggy while-loop that normally sets this never runs without a loaded SWF)
|
||||
m_hasTickedOnce = true;
|
||||
|
||||
UIScene::tick();
|
||||
|
||||
Rml::Context* ctx = RmlManager::Get().GetContext();
|
||||
if (!ctx || !bHasFocus)
|
||||
return;
|
||||
|
||||
//GabsPuN: Once the above comment is made, we can do something like this to increase performance.
|
||||
/*
|
||||
int currentX = g_KBMInput.GetMouseX();
|
||||
int currentY = g_KBMInput.GetMouseY();
|
||||
|
||||
if (currentX != m_lastMouseX || currentY != m_lastMouseY)
|
||||
{
|
||||
ctx->ProcessMouseMove(currentX, currentY, 0);
|
||||
m_lastMouseX = currentX;
|
||||
m_lastMouseY = currentY;
|
||||
}
|
||||
*/
|
||||
|
||||
// Forward mouse position (for hover effects and correct click targeting)
|
||||
ctx->ProcessMouseMove(g_KBMInput.GetMouseX(), g_KBMInput.GetMouseY(), 0);
|
||||
|
||||
// Forward mouse button presses/releases
|
||||
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_LEFT))
|
||||
ctx->ProcessMouseButtonDown(0, 0);
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_LEFT))
|
||||
ctx->ProcessMouseButtonUp(0, 0);
|
||||
if (g_KBMInput.IsMouseButtonPressed(KeyboardMouseInput::MOUSE_RIGHT))
|
||||
ctx->ProcessMouseButtonDown(1, 0);
|
||||
if (g_KBMInput.IsMouseButtonReleased(KeyboardMouseInput::MOUSE_RIGHT))
|
||||
ctx->ProcessMouseButtonUp(1, 0);
|
||||
|
||||
// Forward scroll wheel
|
||||
int wheelDelta = g_KBMInput.GetMouseWheel();
|
||||
if (wheelDelta != 0)
|
||||
ctx->ProcessMouseWheel(wheelDelta / -120, 0);
|
||||
|
||||
ctx->Update();
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::render(S32 width, S32 height, C4JRender::eViewportType viewport)
|
||||
{
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed, bool released, bool &handled)
|
||||
{
|
||||
if (m_bIgnoreInput)
|
||||
@@ -91,23 +176,27 @@ void UIScene_PauseMenu::handleInput(int iPad, int key, bool repeat, bool pressed
|
||||
{
|
||||
case ACTION_MENU_UP:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_UP, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_DOWN:
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_DOWN, 0);
|
||||
handled = true;
|
||||
break;
|
||||
case ACTION_MENU_OK:
|
||||
if (g_KBMInput.IsKeyPressed(VK_RETURN))
|
||||
{
|
||||
ctx->ProcessKeyDown(Rml::Input::KI_RETURN, 0);
|
||||
handled = true;
|
||||
}
|
||||
break;
|
||||
case ACTION_MENU_CANCEL:
|
||||
case ACTION_MENU_PAUSEMENU:
|
||||
navigateBack();
|
||||
handled = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
handled = true;
|
||||
}
|
||||
|
||||
void UIScene_PauseMenu::ProcessEvent(Rml::Event& event)
|
||||
|
||||
Reference in New Issue
Block a user