Files
wii-ipl/src/layout/iplGuiManager.cpp
koopthekoopa ff68d54ab3 clean up
2026-07-08 16:37:32 +01:00

59 lines
2.3 KiB
C++

#include "layout/iplGuiManager.h"
#include "iplMath.h"
#include "iplSystem.h"
#include "system/iplController.h"
namespace ipl {
namespace gui {
void PaneManager::update() {
mbDoneUpdateWithCon = false;
for (int i = 0; i < WPAD_MAX_CONTROLLERS; i++) {
update(i);
}
}
void PaneManager::update(int chan) {
controller::Interface* con = System::getController(chan);
if (System::getFader()->getStatus() == EGG::Fader::PREPARE_OUT) {
if (con && (!mbDisableCon || !mbDoneUpdateWithCon)) {
// Get Projection Area
nw4r::ut::Rect projRect(0.0f, 0.0f, 0.0f, 0.0f);
System::getProjectionRect(&projRect);
// Get Cursor Position
math::VEC2 conProjPos = con->getDpdProjectionPos();
if ((projRect.left > conProjPos.x || conProjPos.x > projRect.right) ||
(projRect.top > conProjPos.y && conProjPos.y > projRect.bottom)) {
conProjPos.y = IPL_MATH_NULL_FLOAT;
conProjPos.x = IPL_MATH_NULL_FLOAT;
}
// Update the base manager with controller input
::gui::Manager::update(chan, conProjPos.x, -conProjPos.y, con->getTrigFlag() | con->getClassicTrigFlag(),
con->getHoldFlag() | con->getClassicHoldFlag(), con->getReleaseFlag() | con->getClassicReleaseFlag(), con);
mbDoneUpdateWithCon = true;
} else {
// Update the base manager without controller input
::gui::Manager::update(chan, IPL_MATH_NULL_FLOAT, IPL_MATH_NULL_FLOAT, 0, 0, 0, NULL);
}
}
}
void PaneManager::setTriggerTarget(nw4r::lyt::Pane* pane, bool bEnable) {
::gui::PaneComponent* component = getPaneComponentByPane(pane);
component->setTriggerTarget(bEnable);
}
void PaneManager::initPane(nw4r::lyt::Pane* pane) {
::gui::PaneComponent* component = getPaneComponentByPane(pane);
if (component) {
component->init();
}
}
} // namespace gui
} // namespace ipl