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