Game.hpp
1 #ifndef CPP3DS_GAME_HPP
2 #define CPP3DS_GAME_HPP
3 
4 #include <vector>
5 #include <cpp3ds/Window/Event.hpp>
6 #include <cpp3ds/Window/Window.hpp>
7 #include <cpp3ds/Graphics/Console.hpp>
8 #include <cpp3ds/Graphics/Shader.hpp>
9 #include <cpp3ds/Graphics/RenderTexture.hpp>
10 #ifdef EMULATION
11  #include <SFML/Graphics.hpp>
12 #else
13  #include <3ds.h>
14 #endif
15 
16 namespace cpp3ds {
17 
18 class Game {
19 public:
20  virtual void update(float delta) = 0;
21  virtual void processEvent(Event& event) = 0;
22  virtual void renderTopScreen(Window& window) = 0;
23  virtual void renderBottomScreen(Window& window) = 0;
24  void console(Screen screen = BottomScreen, Color color = Color::White);
25  void render();
26  void run();
27  void exit();
28  Game();
29  virtual ~Game();
30 protected:
31  Window windowTop, windowBottom;
32 private:
33  bool m_consoleEnabled;
34  bool m_triggerExit;
35  Console m_console;
36 #ifdef EMULATION
37  sf::RenderTexture m_frameTextureTop, m_frameTextureBottom;
38  sf::Sprite m_frameSpriteTop, m_frameSpriteBottom;
39 #else
40  Shader m_shader;
41 #endif
42 };
43 
44 }
45 
46 #endif
47 
48 
Shader class (vertex and fragment)
Definition: Shader.hpp:53
Window that serves as a target for OpenGL rendering.
cpp3ds::Game example goes here
Definition: Game.hpp:18
Class holding a valid drawing context.
Definition: Console.hpp:22
Utility class for manpulating RGBA colors.
Definition: Color.hpp:36
static const Color White
White predefined color.
Definition: Color.hpp:64
Defines a system event and its parameters.
Definition: Event.hpp:15