Hummingbird Framework
 All Classes Functions Variables Modules Pages
Renderer.h
1 #ifndef HB_RENDER_WINDOW_MANAGER_H
2 #define HB_RENDER_WINDOW_MANAGER_H
3 #include <string>
4 #include <memory>
5 #include <queue>
6 #include <SFML/Window.hpp>
7 #include <SFML/Graphics.hpp>
8 #include "../Core/Color.h"
9 #include "../Core/Vector2d.h"
10 #include "../Core/Vector3d.h"
11 #include "Camera.h"
12 
13 namespace hb
14 {
19  typedef sf::RenderWindow Window;
20 
21  class Renderer
22  {
23  public:
24  Renderer();
25  ~Renderer();
26  static void createWindow(const Vector2d& size, std::string title, sf::Uint32 style = sf::Style::Default, const sf::ContextSettings& settings = sf::ContextSettings());
27  static void setCamera(const Camera& camera);
28  static Camera& getCamera();
29  static Window& getWindow();
30  static void addDrawable(std::pair<Vector3d, sf::Drawable*> drawable);
31  static void draw();
32  static void setClearColor(const Color& color);
33 
34  private:
35  class Comparison
36  {
37  public:
38  Comparison(){}
39  bool operator() (const std::pair<Vector3d, sf::Drawable*>& lhs, const std::pair<Vector3d, sf::Drawable*>& rhs) const
40  {
41  return (lhs.first.z > rhs.first.z);
42  }
43  };
44  static std::unique_ptr<Window> s_window;
45  static Camera s_camera;
46  static sf::Color s_clear_color;
47  static std::priority_queue<std::pair<Vector3d, sf::Drawable*>, std::vector<std::pair<Vector3d, sf::Drawable*>>, Comparison> s_drawables;
48  };
49 
51 }
52 #endif
Definition: Camera.h:13
Definition: Renderer.h:21
Definition: Box2DPlugin.h:6
A color represented in the RGBA format.
Definition: Color.h:6
A 2D vector.
Definition: Vector2d.h:14