1 #ifndef _NALCG_VIEW_FRAME_LISTENER_H_
2 #define _NALCG_VIEW_FRAME_LISTENER_H_
4 #include "animationmanager.h"
5 #include "bufferedinputhandler.h"
8 #include <CEGUI/CEGUI.h>
13 class ViewFrameListener
: public FrameListener
16 ViewFrameListener(OIS::Keyboard
* keyboard
, OIS::Mouse
* mouse
,
17 RenderWindow
* window
, Camera
* camera
, SceneManager
* sceneManager
,
19 : mKeyboard(keyboard
), mMouse(mouse
), mAnimationManager(),
20 mHandler(window
, camera
, sceneManager
, &mAnimationManager
, view
),
21 mContinue(true), mWindow(window
), mTime(0), mSceneMgr(sceneManager
),
22 mCamera(camera
), mCreated(false)
24 mDebugOverlay
= OverlayManager::getSingleton().getByName("Core/DebugOverlay");
25 mKeyboard
->setEventCallback(&mHandler
);
26 mMouse
->setEventCallback(&mHandler
);
29 bool frameStarted(const FrameEvent
& evt
);
30 bool frameEnded(const FrameEvent
& evt
);
31 bool quit(const CEGUI::EventArgs
& e
);
32 bool toggleDebugInfo(const CEGUI::EventArgs
& e
);
33 bool handleAnimationSpeedChanged(const CEGUI::EventArgs
& e
);
34 void move(int fromX
, int fromY
, int toX
, int toY
,
35 bool continuous
, unsigned int promoteTo
= 0)
37 mHandler
.move(fromX
, fromY
, toX
, toY
, continuous
, promoteTo
);
39 AnimationManager
& getAnimationManager()
41 return mAnimationManager
;
43 void setCanShowSelectablePieces(bool canShow
)
45 mHandler
.setCanShowSelectablePieces(canShow
);
47 virtual void clearSelectedObject()
49 mHandler
.clearSelectedObject();
53 OIS::Keyboard
* mKeyboard
;
55 AnimationManager mAnimationManager
;
56 BufferedInputHandler mHandler
;
58 Overlay
* mDebugOverlay
;
59 RenderWindow
* mWindow
;
61 SceneManager
* mSceneMgr
;
65 virtual void updateStats();
66 void flashMovableSquares(const Real
& timeSinceLastFrame
);
67 void moveLights(const Real
& timeSinceLastFrame
);
68 void playOpeningAnimation(const Real
& timeSinceLastFrame
);
71 #endif // _NALCG_VIEW_FRAME_LISTENER_H_