TurtleBrains  0.3.5
High quality, portable, C++ framework for rapid 2D game development.
tbx_interface_controller.hpp
1 
9 #ifndef TurtleBrainsExpress_InterfaceController_hpp
10 #define TurtleBrainsExpress_InterfaceController_hpp
11 
12 #include <turtle_brains/core/tb_noncopyable.hpp>
13 #include <turtle_brains/express/interface/tbx_interface.hpp>
14 #include <turtle_brains/game/tb_input_action.hpp>
15 
16 #include <queue>
17 
18 namespace TurtleBrainsExpress
19 {
20  namespace Interface
21  {
22  namespace Unstable
23  {
25  {
26  tbGame::InputAction mNavigateUp;
27  tbGame::InputAction mNavigateDown;
28  tbGame::InputAction mNavigateLeft;
29  tbGame::InputAction mNavigateRight;
30  tbGame::InputAction mAccept;
31  tbGame::InputAction mCancel;
32  };
33 
35  {
36  public:
37  Controller(void);
38  ~Controller(void);
39 
40  void SetInterfaceActions(const InterfaceActions& interfaceActions);
41  void PollControls(void);
42 
43  bool PopEvent(UserEvent& userEvent);
44 
45  Point GetPointerPosition(void) const;
46 
47  inline void SetInterfaceScale(float interfaceScale) { mInterfaceScale = interfaceScale; }
48  inline void SetInterfaceOffset(const Point& interfaceOffset) { mInterfaceOffset = interfaceOffset; }
49 
50  protected:
51  void PushEvent(const UserEventType& eventType, const Point& pointerPosition, const tbCore::tbString& typedCharacter = "");
52 
53  private:
54  void PollTypingControls(const Point& pointerPosition);
55 
56  InterfaceActions mActions;
57  std::queue<UserEvent> mUserEvents;
58  Point mPointerPosition;
59  Point mInterfaceOffset;
60  float mInterfaceScale;
61  };
62 
63  };
64  }; /* namespace Interface */
65 }; /* namespace TurtleBrainsExpress */
66 
68 
69 #endif /* TurtleBrainsExpress_InterfaceController_hpp */
Definition: tb_input_action.hpp:175
Definition: tbx_interface_controller.hpp:24
A collection of objects and functions to express games quickly.
Definition: tb_noncopyable.hpp:22
Definition: tbx_interface.hpp:18
Definition: tbx_interface.hpp:58
Definition: tbx_interface_controller.hpp:34
std::string tbString
Definition: tb_string.hpp:335