Game.hpp
Go to the documentation of this file.
1 #pragma once
2 
5 
6 namespace iv
7 {
8 
10 {
11  std::string configuration_tag;
12 };
13 
14 class Game : protected WindowListener
15 {
16 public:
17  Game( Window * window, GameIdentity const & identity );
18  ~Game();
19 
22  RenderTarget * render_target() const;
23 
24 protected:
25  // Game
27  virtual void game_draw() = 0;
28  virtual void game_focusLost() = 0;
29  virtual bool game_input( Input const * input ) = 0;
30 
31  // WindowListener
32  virtual bool input( Input const * input ) override;
33  virtual void focus_lost() override;
34  virtual void update( uint64_t delta_ms ) override;
35  virtual bool extra_update() override;
36  virtual void draw() override;
37  virtual void gpu( bool enabled, bool dropped ) override;
38  virtual void resized( RenderTarget::Geometry ) override;
39 
40 private:
41  Window * _window;
42  SystemContainer sc;
43  Heap heap;
44 };
45 
46 /*
47 class Game
48 {
49 public:
50  Game( InputSource * input_source ) : _is( input_source ){}
51  virtual ~Game(){}
52 
53  InputSource * input_source() { return this->_is; }
54 
55  //----------------- Game -------------------
58  virtual void game_start() {} ///< Called after first draw. We can draw splash screen in first draw and then load everything (or start loading it) in game_start.
59  virtual bool game_input( const Input * input ) { return false; } ///< \returns True if input was processed by someone.
60  virtual void game_focus_lost() {} ///< Gameplay or anything that depends on realtime player interaction should be paused.
61  virtual void game_update( uint64_t delta_ms ) {}
62  virtual void game_draw() {}
63  virtual void game_exit() {} ///< Called before destructor. May make it a bit easier to do cleanup.
64 
65  virtual void game_geometry( RenderTarget::Geometry geometry ) {}
66  virtual void game_gpu( bool enabled, bool dropped ) {}
68 
69 private:
70  InputSource * _is;
71 };
72 */
73 
74 }