void FontDemo::initialiseFontEditorInfoLabel() { d_fontEditorInfoLabel = d_root->getChild("FontDemoWindow/FontCreator/InfoLabel"); //Create fadeout animation CEGUI::Animation* anim = CEGUI::AnimationManager::getSingleton().createAnimation("ErrorDisplayAndFadeout"); anim->setDuration(5.f); anim->setReplayMode(CEGUI::Animation::RM_Once); // this affector changes YRotation and interpolates keyframes with float interpolator CEGUI::Affector* affector = anim->createAffector("Alpha", "float"); affector->createKeyFrame(0.0f, "1.0"); affector->createKeyFrame(4.0f, "1.0"); affector->createKeyFrame(5.0f, "0.0", CEGUI::KeyFrame::P_QuadraticDecelerating); //anim->defineAutoSubscription(CEGUI::Window::EventTextChanged, "Stop"); anim->defineAutoSubscription(CEGUI::Window::EventTextChanged, "Start"); CEGUI::AnimationInstance* instance = CEGUI::AnimationManager::getSingleton().instantiateAnimation(anim); // after we instantiate the animation, we have to set its target window instance->setTargetWindow(d_fontEditorInfoLabel); // at this point, you can start this instance and see the results instance->start(); }
bool GameMenuDemo::handleNaviSelectionIconAnimStart(const CEGUI::EventArgs& args) { const CEGUI::AnimationEventArgs& animArgs = static_cast<const CEGUI::AnimationEventArgs&>(args); CEGUI::AnimationInstance* animInst = animArgs.instance; if(animInst->getDefinition() == CEGUI::AnimationManager::getSingleton().getAnimation("LoopRotateRight")) { CEGUI::Quaternion curRotation = animInst->getTarget()->getProperty<CEGUI::Quaternion>("Rotation"); float curAngle = getAngle(curRotation); float progress = curAngle / (2.0f * static_cast<float>(M_PI)); animInst->setPosition(progress * animInst->getDefinition()->getDuration()); } return false; }
void GameMenuDemo::setupAnimations() { AnimationManager& animMgr = AnimationManager::getSingleton(); animMgr.loadAnimationsFromXML("GameMenu.anims"); CEGUI::Animation* startButtAnim = animMgr.getAnimation("StartButtonPulsating"); CEGUI::AnimationInstance* startButtAnimInstance = animMgr.instantiateAnimation(startButtAnim); CEGUI::Window* startButtWindow = d_root->getChild("InnerPartContainer/InsideStartClickArea/StartButtonImage"); startButtAnimInstance->setTargetWindow(startButtWindow); startButtAnimInstance->start(); CEGUI::Animation* insideImg1Anim = animMgr.getAnimation("InsideImage1Pulsating"); CEGUI::AnimationInstance* insideImg1AnimInst = animMgr.instantiateAnimation(insideImg1Anim); CEGUI::Window* insideImg1 = d_root->getChild("InnerPartContainer/InsideImage1"); insideImg1AnimInst->setTargetWindow(insideImg1); insideImg1AnimInst->start(); CEGUI::Animation* topBarAnim = animMgr.getAnimation("TopBarMoveInAnimation"); d_topBarAnimInst = animMgr.instantiateAnimation(topBarAnim); CEGUI::Window* topBarWindow = d_root->getChild("TopBar"); d_topBarAnimInst->setTargetWindow(topBarWindow); CEGUI::Animation* botBarAnim = animMgr.getAnimation("BotBarMoveInAnimation"); d_botBarAnimInst = animMgr.instantiateAnimation(botBarAnim); CEGUI::Window* botBarWindow = d_root->getChild("BotBar"); d_botBarAnimInst->setTargetWindow(botBarWindow); CEGUI::Animation* insideBlendInAnim = animMgr.getAnimation("InsideBlendIn"); d_insideBlendInAnimInst = animMgr.instantiateAnimation(insideBlendInAnim); CEGUI::Window* innerPartContainer = d_root->getChild("InnerPartContainer"); d_insideBlendInAnimInst->setTargetWindow(innerPartContainer); CEGUI::Animation* insideImage3RotateIn = animMgr.getAnimation("InsideImage3RotateIn"); d_insideImage3RotateInInst = animMgr.instantiateAnimation(insideImage3RotateIn); CEGUI::Window* insideImage3 = d_root->getChild("InnerPartContainer/OuterRingsContainer/InsideImage3"); d_insideImage3RotateInInst->setTargetWindow(insideImage3); CEGUI::Animation* insideImage4RotateIn = animMgr.getAnimation("InsideImage4RotateIn"); d_insideImage4RotateInInst = animMgr.instantiateAnimation(insideImage4RotateIn); CEGUI::Window* insideImage4 = d_root->getChild("InnerPartContainer/OuterRingsContainer/InsideImage4"); d_insideImage4RotateInInst->setTargetWindow(insideImage4); CEGUI::Animation* insideImageRingsContainerSizeIn = animMgr.getAnimation("RingsContainerSizeIn"); d_insideImageRingsContainerSizeInInst = animMgr.instantiateAnimation(insideImageRingsContainerSizeIn); CEGUI::Window* insideImageContainer = d_root->getChild("InnerPartContainer/OuterRingsContainer"); d_insideImageRingsContainerSizeInInst->setTargetWindow(insideImageContainer); CEGUI::Animation* buttonFadeInAnim = animMgr.getAnimation("ButtonFadeIn"); d_buttonFadeInAnimInst1 = animMgr.instantiateAnimation(buttonFadeInAnim); CEGUI::Window* window = d_root->getChild("InnerButtonsContainer/ButtonOptions"); d_buttonFadeInAnimInst1->setTargetWindow(window); d_buttonFadeInAnimInst2 = animMgr.instantiateAnimation(buttonFadeInAnim); window = d_root->getChild("InnerButtonsContainer/ButtonLoad"); d_buttonFadeInAnimInst2->setTargetWindow(window); d_buttonFadeInAnimInst3 = animMgr.instantiateAnimation(buttonFadeInAnim); window = d_root->getChild("InnerButtonsContainer/ButtonSave"); d_buttonFadeInAnimInst3->setTargetWindow(window); d_buttonFadeInAnimInst4 = animMgr.instantiateAnimation(buttonFadeInAnim); window = d_root->getChild("InnerButtonsContainer/ButtonCharacters"); d_buttonFadeInAnimInst4->setTargetWindow(window); d_buttonFadeInAnimInst5 = animMgr.instantiateAnimation(buttonFadeInAnim); window = d_root->getChild("InnerButtonsContainer/ButtonQuit"); d_buttonFadeInAnimInst5->setTargetWindow(window); CEGUI::Animation* loginContainerMoveInAnim = animMgr.getAnimation("LoginMoveIn"); d_loginContainerMoveInInst = animMgr.instantiateAnimation(loginContainerMoveInAnim); d_loginContainerMoveInInst->setTargetWindow(d_loginContainer); CEGUI::Animation* loginContainerMoveOutAnim = animMgr.getAnimation("LoginMoveOut"); d_loginContainerMoveOutInst = animMgr.instantiateAnimation(loginContainerMoveOutAnim); d_loginContainerMoveOutInst->setTargetWindow(d_loginContainer); CEGUI::Animation* naviButtonRightMoveInAnim = animMgr.getAnimation("NaviButtonRightMoveIn"); d_naviButtonRightMoveInInst = animMgr.instantiateAnimation(naviButtonRightMoveInAnim); window = d_root->getChild("BotNavigationContainer/RightArrow"); d_naviButtonRightMoveInInst->setTargetWindow(window); CEGUI::Animation* naviButtonLeftMoveInAnim = animMgr.getAnimation("NaviButtonLeftMoveIn"); d_naviButtonLeftMoveInInst = animMgr.instantiateAnimation(naviButtonLeftMoveInAnim); window = d_root->getChild("BotNavigationContainer/LeftArrow"); d_naviButtonLeftMoveInInst->setTargetWindow(window); CEGUI::Animation* naviBotMoveInAnim = animMgr.getAnimation("NaviBotCenterMoveIn"); d_naviBotMoveInInst = animMgr.instantiateAnimation(naviBotMoveInAnim); window = d_root->getChild("BotNavigationContainer/NaviCenterContainer"); d_naviBotMoveInInst->setTargetWindow(window); CEGUI::Animation* blendInAnim = animMgr.getAnimation("BlendIn"); d_startButtonBlendInAnimInst = animMgr.instantiateAnimation(blendInAnim); d_startButtonBlendInAnimInst->setTargetWindow(d_startButtonClickArea); CEGUI::Animation* partialBlendOutAnim = animMgr.getAnimation("PartialBlendOut"); window = d_root->getChild("BotNavigationContainer"); d_naviPartialBlendOutInst = animMgr.instantiateAnimation(partialBlendOutAnim); d_naviPartialBlendOutInst->setTargetWindow(window); d_naviBlendInInst = animMgr.instantiateAnimation(blendInAnim); d_naviBlendInInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer"); d_centerButtonsPartialBlendOutInst = animMgr.instantiateAnimation(partialBlendOutAnim); d_centerButtonsPartialBlendOutInst->setTargetWindow(window); d_centerButtonsBlendInInst = animMgr.instantiateAnimation(blendInAnim); d_centerButtonsBlendInInst->setTargetWindow(window); window = d_root->getChild("BotNavigationContainer/NaviCenterContainer/NavigationLabel"); d_navigationLabelPartialBlendOutInst = animMgr.instantiateAnimation(partialBlendOutAnim); d_navigationLabelPartialBlendOutInst->setTargetWindow(window); d_navigationLabelBlendInAnimInst = animMgr.instantiateAnimation(blendInAnim); d_navigationLabelBlendInAnimInst->setTargetWindow(window); CEGUI::Animation* travelRotateInAnim = animMgr.getAnimation("TravelRotateIn"); CEGUI::AnimationInstance* travelRotateInInst = animMgr.instantiateAnimation(travelRotateInAnim); travelRotateInInst->setTargetWindow(d_navigationTravelIcon); CEGUI::Animation* travelRotateOutAnim = animMgr.getAnimation("TravelRotateOut"); CEGUI::AnimationInstance* travelRotateOutInst = animMgr.instantiateAnimation(travelRotateOutAnim); travelRotateOutInst->setTargetWindow(d_navigationTravelIcon); CEGUI::Animation* blendOutAnim = animMgr.getAnimation("FullBlendOut"); d_botBarLabelBlendOutInst = animMgr.instantiateAnimation(blendOutAnim); d_botBarLabelBlendOutInst->setTargetWindow(d_botBarLabel); CEGUI::Animation* loopRotateRightAnim = animMgr.getAnimation("LoopRotateRight"); CEGUI::Animation* stopRotateAnim = animMgr.getAnimation("StopRotate"); CEGUI::AnimationInstance* loopRotateRightAnimInst = animMgr.instantiateAnimation(loopRotateRightAnim); loopRotateRightAnimInst->setTargetWindow(d_navigationSelectionIcon); CEGUI::AnimationInstance* loopRotateLeftAnimInst = animMgr.instantiateAnimation(stopRotateAnim); loopRotateLeftAnimInst->setTargetWindow(d_navigationSelectionIcon); window = d_root->getChild("BotNavigationContainer/RightArrow"); CEGUI::Animation* naviArrowRightTwitch = animMgr.getAnimation("NaviArrowRightTwitch"); CEGUI::AnimationInstance* naviArrowRightTwitchInst = animMgr.instantiateAnimation(naviArrowRightTwitch); naviArrowRightTwitchInst->setTargetWindow(window); CEGUI::Animation* naviArrowRightReturn = animMgr.getAnimation("NaviArrowRightReturn"); CEGUI::AnimationInstance* naviArrowRightReturnInst = animMgr.instantiateAnimation(naviArrowRightReturn); naviArrowRightReturnInst->setTargetWindow(window); window = d_root->getChild("BotNavigationContainer/LeftArrow"); CEGUI::Animation* naviArrowLeftTwitch = animMgr.getAnimation("NaviArrowLeftTwitch"); CEGUI::AnimationInstance* naviArrowLeftTwitchInst = animMgr.instantiateAnimation(naviArrowLeftTwitch); naviArrowLeftTwitchInst->setTargetWindow(window); CEGUI::Animation* naviArrowLeftReturn = animMgr.getAnimation("NaviArrowLeftReturn"); CEGUI::AnimationInstance* naviArrowLeftReturnInst = animMgr.instantiateAnimation(naviArrowLeftReturn); naviArrowLeftReturnInst->setTargetWindow(window); setupPopupLinesAnimations(); setupSelectionIconAnimations(); }
void GameMenuDemo::setupSelectionIconAnimations() { CEGUI::Window* window; CEGUI::AnimationManager& animMgr = CEGUI::AnimationManager::getSingleton(); CEGUI::Animation* iconAnimationLoop = animMgr.getAnimation("LoopRotateRight"); CEGUI::Animation* iconAnimationStop = animMgr.getAnimation("StopRotate"); CEGUI::AnimationInstance* iconAnimInst; window = d_root->getChild("InnerButtonsContainer/LoadSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/SaveSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/NoSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/YesSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/SelectSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/SaveSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/AudioSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/VideoSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/ControlsSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/Name2SelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/NewSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); window = d_root->getChild("InnerButtonsContainer/DeleteSelectionIcon"); iconAnimInst = animMgr.instantiateAnimation(iconAnimationLoop); iconAnimInst->setTargetWindow(window); iconAnimInst = animMgr.instantiateAnimation(iconAnimationStop); iconAnimInst->setTargetWindow(window); }