code cleanup: make header defines more consistent, JOYSENSOR header guard had a typo...
[blender-staging.git] / source / gameengine / Ketsji / KX_TouchEventManager.h
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
19  * All rights reserved.
20  *
21  * The Original Code is: all of this file.
22  *
23  * Contributor(s): none yet.
24  *
25  * ***** END GPL LICENSE BLOCK *****
26  */
27
28 /** \file KX_TouchEventManager.h
29  *  \ingroup ketsji
30  */
31
32 #ifndef __KX_TOUCHEVENTMANAGER_H__
33 #define __KX_TOUCHEVENTMANAGER_H__
34
35
36 #include "SCA_EventManager.h"
37 #include "KX_TouchSensor.h"
38 #include "KX_GameObject.h"
39
40 #include <vector>
41 #include <set>
42
43 class SCA_ISensor;
44 class PHY_IPhysicsEnvironment;
45
46 class KX_TouchEventManager : public SCA_EventManager
47 {
48         typedef std::pair<PHY_IPhysicsController*, PHY_IPhysicsController*> NewCollision;
49         PHY_IPhysicsEnvironment*        m_physEnv;
50         
51         std::set<NewCollision> m_newCollisions;
52         
53         
54         static bool newCollisionResponse(void *client_data, 
55                                                 void *object1,
56                                                 void *object2,
57                                                 const PHY_CollData *coll_data);
58
59         static bool newBroadphaseResponse(void *client_data, 
60                                                 void *object1,
61                                                 void *object2,
62                                                 const PHY_CollData *coll_data);
63
64         virtual bool    NewHandleCollision(void* obj1,void* obj2,
65                                                 const PHY_CollData * coll_data); 
66
67
68
69
70
71 public:
72         KX_TouchEventManager(class SCA_LogicManager* logicmgr,  
73                 PHY_IPhysicsEnvironment* physEnv);
74         virtual void NextFrame();
75         virtual void    EndFrame();
76         virtual void RegisterSensor(SCA_ISensor* sensor);
77         virtual void RemoveSensor(SCA_ISensor* sensor);
78         SCA_LogicManager* GetLogicManager() { return m_logicmgr;}
79         PHY_IPhysicsEnvironment *GetPhysicsEnvironment() { return m_physEnv; }
80         virtual void    Replace_PhysicsScene(PHY_IPhysicsEnvironment* env) { m_physEnv= env; }
81
82         
83 #ifdef WITH_CXX_GUARDEDALLOC
84         MEM_CXX_CLASS_ALLOC_FUNCS("GE:KX_TouchEventManager")
85 #endif
86 };
87
88 #endif  /* __KX_TOUCHEVENTMANAGER_H__ */