Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

SCA_MouseManager.cpp

Go to the documentation of this file.
00001 
00007 
00008 
00009 #include "BoolValue.h"
00010 
00011 
00012 #include "SCA_MouseManager.h"
00013 #include "SCA_MouseSensor.h"
00014 #include "SCA_ISystem.h"
00015 #include "IntValue.h"
00016 
00017 
00018 void SCA_MouseManager::NextFrame(double curtime,double deltatime)

00019 {
00020         
00021         for (int i=0;i<m_sensors.size();i++)
00022         {
00023                 SCA_MouseSensor* mousesensor = (SCA_MouseSensor*) m_sensors[i];
00024 
00025                 // (0,0) is the Upper Left corner
00026                 // in our local window coordinates
00027 
00028                 const SCA_InputEvent& event = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
00029                 int mx = event.m_eventval;
00030                 const SCA_InputEvent& event2 = m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
00031                 int my = event2.m_eventval;
00032         
00033                 mousesensor->setX(mx);
00034                 mousesensor->setY(my);
00035 
00036                 mousesensor->Activate(m_logicmanager,NULL);
00037 
00038         }
00039 }
00040 
00041 void  SCA_MouseManager::RegisterSensor(SCA_ISensor* keysensor)

00042 {
00043         m_sensors.push_back(keysensor);
00044 }
00045 
00046 bool SCA_MouseManager::IsPressed(SCA_IInputDevice::KX_EnumInputs inputcode)

00047 {
00048         /* We should guard for non-mouse events maybe? A rather silly side       */
00049         /* effect here is that position-change events are considered presses as  */
00050         /* well.                                                                 */
00051         
00052         return m_mousedevice->IsPressed(inputcode);
00053 }

Generated at Thu Feb 1 13:03:10 2001 for Ketsji Game Engine by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000