PROTO::KLUDGE  0.1
Quick prototyping library for games using SDL and OpenGL.
SensorData.hpp
Go to the documentation of this file.
1 #ifndef SENSORDATA_HPP
2 #define SENSORDATA_HPP
3 
4 namespace pk
5 {
6 
13 {
18 };
19 
31 {
32  public:
37  SensorData();
38 
43  SensorData(int id)
44  {
45  m_id = id;
46  m_contacts = 0;
47  };
48 
50  {
51 
52  }
53 
62  void contactMade()
63  {
64  m_contacts++;
65  //if(m_id == SensorType::LEFT || m_id == SensorType::RIGHT || m_id == SensorType::TOP)
66  // printf("contacts made: %i\n", m_contacts);
67  };
68 
77  void contactEnded()
78  {
79  m_contacts--;
80  //if(m_id == SensorType::LEFT || m_id == SensorType::RIGHT || m_id == SensorType::TOP)
81  // printf("contacts made: %i\n", m_contacts);
82  };
83 
91  int getContacts(){ return m_contacts; };
92  int getID(){ return m_id; };
93 
94  private:
95  int m_id;
96  int m_contacts;
97 };
98 
99 }
100 
101 #endif //SENSORDATA_HPP
Definition: Game.hpp:7
int getID()
Definition: SensorData.hpp:92
A class wrapping some user data for Box2D fixtures. Includes data for number of contacts being made t...
Definition: SensorData.hpp:30
void contactEnded()
Decrements the number of contacts made to the sensor. Call this function inside a Box2D contact liste...
Definition: SensorData.hpp:77
Definition: SensorData.hpp:15
void contactMade()
Increments the number of contacts made to the sensor. Call this function inside a Box2D contact liste...
Definition: SensorData.hpp:62
Definition: SensorData.hpp:17
~SensorData()
Definition: SensorData.hpp:49
int m_contacts
the number of contacts made with the sensor.
Definition: SensorData.hpp:96
int getContacts()
Get the number of contacts currently being made to the sensor.
Definition: SensorData.hpp:91
SensorData(int id)
Preferred constructor.
Definition: SensorData.hpp:43
Definition: SensorData.hpp:14
Definition: SensorData.hpp:16
SensorData()
Default constructor.
SensorType
The type of sensor data represented.
Definition: SensorData.hpp:12
int m_id
the sensor's ID.
Definition: SensorData.hpp:92