-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrenderable.h
52 lines (42 loc) · 1.14 KB
/
renderable.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef _RENDERABLE_
#define _RENDERABLE_
#include <QKeyEvent>
class Viewer;
/**
* General interface of renderable objetcs, that can be displayed
* in the Viewer class.
* It just defines three methods to override in child classes to
* initialize, draw and animate a renderable objetc.
*/
class Renderable
{
public:
/// Virtual destructor (mandatory!)
virtual ~Renderable() {};
/**
* Initializes a Renderable objet before it is draw.
* Default behavior: nothing is done.
*/
virtual void init(Viewer&) {};
/**
* Draw a Renderable object.
* This pure virtual method must be overriden if child classes.
*/
virtual void draw() = 0;
/**
* Animate an object. This method is invoked before each call of draw().
* Default behavior: nothing is done.
*/
virtual void animate() {};
/**
* Objects can respond to key events.
* Default behavior: nothing is done.
*/
virtual void keyPressEvent(QKeyEvent*, Viewer&) {};
/**
* Objects can respond to mouse events.
* Default behavior: nothing is done.
*/
virtual void mouseMoveEvent(QMouseEvent*, Viewer&) {};
};
#endif