GameKit  0.0.1a
C++ gamedev tools
AbstractView.hpp
Go to the documentation of this file.
1 /*
2  * =====================================================================================
3  *
4  * Filename: AbstractView.hpp
5  *
6  * Description:
7  *
8  * Created: 26/01/2018 00:41:03
9  *
10  * Author: Quentin Bazin, <quent42340@gmail.com>
11  *
12  * =====================================================================================
13  */
14 #ifndef GK_ABSTRACTVIEW_HPP_
15 #define GK_ABSTRACTVIEW_HPP_
16 
17 #include "gk/gl/RenderTarget.hpp"
19 
20 namespace gk {
21 
22 class AbstractView {
23  public:
24  virtual ~AbstractView() = default;
25 
26  virtual void draw(const SceneObject &object, RenderTarget &target, RenderStates states) = 0;
27 
28  virtual void draw(const SceneObjectList &objectList, RenderTarget &target, RenderStates states) {
29  for(auto &object : objectList) {
30  draw(object, target, states);
31 
32  if (object.has<SceneObjectList>())
33  draw(object.get<SceneObjectList>(), target, states);
34  }
35  }
36 };
37 
38 } // namespace gk
39 
40 #endif // GK_ABSTRACTVIEW_HPP_
virtual void draw(const SceneObject &object, RenderTarget &target, RenderStates states)=0
virtual void draw(const SceneObjectList &objectList, RenderTarget &target, RenderStates states)
virtual ~AbstractView()=default