hx3d  1
2D/3D Simple Game Framework
display.hpp
1 /*
2  Audio effect display.
3  Copyright (C) 2015 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_AUDIO_DISPLAY
22 #define HX3D_AUDIO_DISPLAY
23 
24 #include "hx3d/graphics/sprite.hpp"
25 #include "hx3d/graphics/image.hpp"
26 
27 #include "hx3d/utils/timer.hpp"
28 #include "hx3d/utils/ptr.hpp"
29 
30 namespace hx3d {
31 namespace audio {
32 
41 class Display: public graphics::Sprite {
42 
43 public:
49  Display();
50 
58  Display(const int refreshDelay);
59  virtual ~Display();
60 
67  void initialize(const unsigned int width, const unsigned int height);
68 
74  void setRefreshDelay(const int refreshDelay);
75 
83  virtual void update(const Sint16* stream, const int length, const float delta) = 0;
84 
90  virtual void onInitialization();
91 
92  void setTexture(const Ptr<graphics::Texture>&) = delete;
93  void setTexture(const Ptr<graphics::Framebuffer>&) = delete;
94 
95 protected:
104 
108  void drawBorders();
109 };
110 
111 } /* audio */
112 } /* hx3d */
113 
114 #endif
Simple timer.
Definition: timer.hpp:31
virtual void update(const Sint16 *stream, const int length, const float delta)=0
Update the display.
void drawBorders()
Draw white borders.
Definition: display.cpp:51
void setRefreshDelay(const int refreshDelay)
Set the refresh delay.
Definition: display.cpp:44
Audio effect display.
Definition: display.hpp:41
hx3d framework namespace
Definition: audio.hpp:26
Timer _timer
Refresh timer.
Definition: display.hpp:99
void initialize(const unsigned int width, const unsigned int height)
Initialize the display.
Definition: display.cpp:32
Display()
Create an empty display with a refresh delay of 50.
Definition: display.cpp:28
int _refreshDelay
Refresh delay.
Definition: display.hpp:101
graphics::Image _image
Drawing image.
Definition: display.hpp:97
Real-time editable texture.
Definition: image.hpp:36
2D texture manipulation.
Definition: sprite.hpp:62
bool _initialized
Is the display initialized ?
Definition: display.hpp:103
virtual void onInitialization()
Use this to execute code after initialization.
Definition: display.cpp:49
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition: ptr.hpp:34