Exemple #1
0
	bool Widget::TabbableWindow_KeyDown(const CEGUI::EventArgs& args)
	{
		const CEGUI::KeyEventArgs& keyEventArgs = static_cast<const CEGUI::KeyEventArgs&>(args);
		if (keyEventArgs.scancode == CEGUI::Key::Tab)
		{
			//find the window in the list of tabbable windows
			CEGUI::Window* activeWindow = mMainWindow->getActiveChild();
			if (activeWindow) {
//				WindowMap::iterator I = std::find(mTabOrder.begin(), mTabOrder.end(), activeWindow);
				WindowMap::iterator I = mTabOrder.find(activeWindow);
				if (I != mTabOrder.end()) {
					I->second->activate();
					//we don't want to process the event any more, in case something else will try to interpret the tab event to also change the focus
					Input::getSingleton().suppressFurtherHandlingOfCurrentEvent();
					return true;
				}
			}
		} else if (keyEventArgs.scancode == CEGUI::Key::Return)
		{
			//iterate through all enter buttons, and if anyone is visible, activate it
			for (WindowStore::iterator I = mEnterButtons.begin(); I != mEnterButtons.end(); ++I) {
				if ((*I)->isVisible()) {
					CEGUI::Window* window = *I;
					WindowEventArgs args(window);
					window->fireEvent(PushButton::EventClicked, args, PushButton::EventNamespace);
					break;
				}
			}
		}
		return false;
	}
Exemple #2
0
void HUDDemo::createScorePopup(const CEGUI::Vector2<float>& mousePos, int points)
{
    CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();

    CEGUI::Window* popupWindow = winMgr.createWindow("HUDDemo/PopupLabel");
    d_rootIngame->addChild(popupWindow);
    popupWindow->setPosition(CEGUI::UVector2(cegui_absdim(mousePos.d_x), cegui_absdim(mousePos.d_y)));
    popupWindow->setText(CEGUI::PropertyHelper<int>::toString(points));
    popupWindow->setRiseOnClickEnabled(false);
    popupWindow->subscribeEvent(AnimationInstance::EventAnimationEnded, Event::Subscriber(&HUDDemo::handleScorePopupAnimationEnded, this));
    popupWindow->setPixelAligned(false);
    popupWindow->setFont("DejaVuSans-14");

    popupWindow->setPosition(popupWindow->getPosition() + CEGUI::UVector2(cegui_reldim(0.03f), cegui_reldim(-0.02f)));

    if(points < 0)
        popupWindow->setProperty("NormalTextColour", "FF880000");
    else
    {
        popupWindow->setText( "+" + popupWindow->getText());
        popupWindow->setProperty("NormalTextColour", "FF006600");
    }

    CEGUI::EventArgs args;
    popupWindow->fireEvent("StartAnimation", args);
}
Exemple #3
0
bool GameMenuDemo::handleInnerButtonsLabelLeft(const CEGUI::EventArgs& args)
{
    const CEGUI::MouseEventArgs& mouseArgs = static_cast<const CEGUI::MouseEventArgs&>(args);

    CEGUI::Window* iconWindow = getIconWindowFromLabel(mouseArgs.window);
 
    CEGUI::EventArgs fireArgs;
    iconWindow->fireEvent("StopRotate", fireArgs);

    return false;
}