hx3d  1
2D/3D Simple Game Framework
transition.hpp
1 /*
2  Screen transition.
3  Copyright (C) 2016 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_GRAPHICS_TRANSITION
22 #define HX3D_GRAPHICS_TRANSITION
23 
24 #include "hx3d/graphics/batch.hpp"
25 #include "hx3d/graphics/framebuffer.hpp"
26 
27 namespace hx3d {
28 
29 namespace window {
30  class Game;
31 }
32 
33 namespace graphics {
34 
38 class Transition {
39 public:
40 
46  Transition(window::Game* game);
47 
51  void start();
52 
56  void reset();
57 
63  void setDuration(float duration);
64 
70  bool isRunning() const;
71 
77  bool isFinished() const;
78 
84  void update(float delta);
85 
93  virtual void render(Batch& batch, Framebuffer& currentFB, Framebuffer& nextFB) = 0;
94 
100  virtual void onUpdate(float delta);
101 
105  virtual void onDone();
106 
110  virtual void onStart();
111 
112 protected:
114  float _duration;
118  bool _running;
121 };
122 
123 } /* graphics */
124 } /* hx3d */
125 
126 #endif /* HX3D_GRAPHICS_TRANSITION */
float _currentTime
Current time in seconds.
Definition: transition.hpp:116
bool _running
Is the transition running.
Definition: transition.hpp:118
Game main class: multiple screens management.
Definition: game.hpp:42
hx3d framework namespace
Definition: audio.hpp:26
Transition between two screens.
Definition: transition.hpp:38
float _duration
Duration in seconds.
Definition: transition.hpp:114
Simple base batch implementation. Draw at each draw call.
Definition: batch.hpp:36
Render-to-texture buffer.
Definition: framebuffer.hpp:37
window::Game * _game
Current game.
Definition: transition.hpp:120