1 | |
---|
2 | /////////////////////////////////////////////////////////////////////////// |
---|
3 | // |
---|
4 | // Realistic rain real-time simulation program |
---|
5 | // |
---|
6 | // Pierre Rousseau |
---|
7 | // |
---|
8 | /////////////////////////////////////////////////////////////////////////// |
---|
9 | // |
---|
10 | // Main camera, and external events (mouse/keyboard) handling |
---|
11 | // |
---|
12 | /////////////////////////////////////////////////////////////////////////// |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | #ifndef __RAIN_FRAME_LISTENER__ |
---|
17 | #define __RAIN_FRAME_LISTENER__ |
---|
18 | |
---|
19 | #include "CommonRain.h" |
---|
20 | #include "RainCloseDropsParticles.h" |
---|
21 | #include <ExampleFrameListener.h> |
---|
22 | |
---|
23 | |
---|
24 | |
---|
25 | |
---|
26 | /** RainFrameListener class |
---|
27 | * processes keyboard and mouse events, |
---|
28 | * and performs all computations needed for each frame |
---|
29 | */ |
---|
30 | class RainFrameListener : public ExampleFrameListener |
---|
31 | { |
---|
32 | private: |
---|
33 | |
---|
34 | SceneNode *mViewNode, *mCameraNode; |
---|
35 | Real timer; |
---|
36 | CloseDropsParticles *mRainSystem; |
---|
37 | |
---|
38 | public: |
---|
39 | |
---|
40 | /** |
---|
41 | ** standard constructor |
---|
42 | ** - the renderWindow and camera are needed for reglar initialization of the frame listener |
---|
43 | ** - view node will only be translated (position of the observer and particle system) |
---|
44 | ** - cameranode, which must be attached to viewNode, will be rotated to look in any direction |
---|
45 | ** - syst is the particle system itself, which will need to be updated with user input, time since last frame... |
---|
46 | */ |
---|
47 | RainFrameListener(RenderWindow* win, Camera* cam, SceneNode* ViewNode, SceneNode* CameraNode, CloseDropsParticles *syst); |
---|
48 | |
---|
49 | /** |
---|
50 | ** this function is called just before a frame gets rendered |
---|
51 | ** Contains reactions to user input (keyboard, mouse), and calls for particle system update |
---|
52 | */ |
---|
53 | bool frameStarted(const FrameEvent& evt); |
---|
54 | |
---|
55 | /** |
---|
56 | ** this function is called just after a frame gets rendered |
---|
57 | */ |
---|
58 | bool frameEnded(const FrameEvent& evt); |
---|
59 | |
---|
60 | protected: |
---|
61 | /** |
---|
62 | ** function to update the text of the overlay with fps stats |
---|
63 | */ |
---|
64 | void updateStats(void); |
---|
65 | |
---|
66 | /** |
---|
67 | ** function to set a specific text on the stats overlay |
---|
68 | */ |
---|
69 | void displayMessage(String text); |
---|
70 | }; |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | #endif //__RAIN_FRAME_LISTENER__ |
---|