Roguelike
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
gamething.h
Go to the documentation of this file.
1 #ifndef BADGAME_BASE_GAMETHING_H_
2 #define BADGAME_BASE_GAMETHING_H_
3 
4 // Inheritance
5 // (none)
6 
7 // External Dependencies
8 #include <ugdk/math/integer2D.h>
9 
10 // Internal Dependencies
11 // (none)
12 
13 // Forward Declarations
14 #include <ugdk/math.h>
15 #include "game/base.h"
16 
17 namespace game {
18 namespace base {
19 
20 class GameThing {
21  public:
22  GameThing(GameObject* obj) : obj_(obj), tile_() {}
23  GameThing(const ugdk::math::Integer2D& tile) : obj_(nullptr), tile_(tile) {}
24  GameThing() : obj_(nullptr), tile_(ugdk::math::Integer2D(-1, -1)) {}
26 
27  bool is_obj() const { return obj_ != nullptr; }
28  const GameObject* obj() const { return obj_; }
29  GameObject* obj() { return obj_; }
30  const ugdk::math::Integer2D& tile() const { return tile_; }
31  ugdk::math::Integer2D& tile() { return tile_; }
32 
33  private:
34  GameObject* obj_;
35  ugdk::math::Integer2D tile_;
36 };
37 
38 } // namespace base
39 } // namespace game
40 
41 #endif // BADGAME_BASE_GAMETHING_H_
Definition: gameobject.h:53
GameObject * obj()
Definition: gamething.h:29
GameThing(const ugdk::math::Integer2D &tile)
Definition: gamething.h:23
~GameThing()
Definition: gamething.h:25
Definition: integer2Dutils.cc:4
Definition: aim.cc:15
GameThing()
Definition: gamething.h:24
const GameObject * obj() const
Definition: gamething.h:28
const ugdk::math::Integer2D & tile() const
Definition: gamething.h:30
ugdk::math::Integer2D & tile()
Definition: gamething.h:31
bool is_obj() const
Definition: gamething.h:27
Definition: gamething.h:20
GameThing(GameObject *obj)
Definition: gamething.h:22