optionally use guarded alloc for tiles compositor, also replace allocation functions...
[blender.git] / source / gameengine / GameLogic / SCA_MouseManager.cpp
index ca875dad07c833a26a924582b3f194a637c6d83f..a067b9c4d5b500d0919f22bf6570b12f5d698973 100644 (file)
@@ -1,8 +1,7 @@
-/**
+/*
  * Manager for mouse events
  *
  *
- * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
@@ -18,7 +17,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software Foundation,
- * Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  *
  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
  * All rights reserved.
  * ***** END GPL LICENSE BLOCK *****
  */
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+/** \file gameengine/GameLogic/SCA_MouseManager.cpp
+ *  \ingroup gamelogic
+ */
 
-#ifdef WIN32
+
+#if defined(WIN32) && !defined(FREE_WINDOWS)
 // This warning tells us about truncation of __long__ stl-generated names.
 // It can occasionally cause DevStudio to have internal compiler warnings.
 #pragma warning( disable : 4786 )     
 #include "SCA_MouseManager.h"
 #include "SCA_MouseSensor.h"
 #include "IntValue.h"
+#include "RAS_ICanvas.h"
 
 
 SCA_MouseManager::SCA_MouseManager(SCA_LogicManager* logicmgr,
-                                                                  SCA_IInputDevice* mousedev)
-       :       SCA_EventManager(MOUSE_EVENTMGR),
+                                                                  SCA_IInputDevice* mousedev,
+                                                                  RAS_ICanvas* canvas)
+       :       SCA_EventManager(logicmgr, MOUSE_EVENTMGR),
                m_mousedevice (mousedev),
-               m_logicmanager(logicmgr)
+               m_canvas(canvas)
 {
        m_xpos = 0;
        m_ypos = 0;
@@ -75,25 +77,26 @@ void SCA_MouseManager::NextFrame()
 {
        if (m_mousedevice)
        {
-               set<SCA_ISensor*>::iterator it;
-               for (it=m_sensors.begin(); it!=m_sensors.end(); it++)
+               SG_DList::iterator<SCA_ISensor> it(m_sensors);
+               for (it.begin();!it.end();++it)
                {
                        SCA_MouseSensor* mousesensor = (SCA_MouseSensor*)(*it);
                        // (0,0) is the Upper Left corner in our local window
                        // coordinates
                        if (!mousesensor->IsSuspended())
                        {
-                               const SCA_InputEvent& event = 
+                               const SCA_InputEvent& event1 = 
                                        m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEX);
-                               int mx = event.m_eventval;
                                const SCA_InputEvent& event2 = 
                                        m_mousedevice->GetEventValue(SCA_IInputDevice::KX_MOUSEY);
-                               int my = event2.m_eventval;
+
+                               int mx = this->m_canvas->GetMouseX(event1.m_eventval);
+                               int my = this->m_canvas->GetMouseY(event2.m_eventval);
                                
                                mousesensor->setX(mx);
                                mousesensor->setY(my);
                                
-                               mousesensor->Activate(m_logicmanager,NULL);
+                               mousesensor->Activate(m_logicmgr);
                        }
                }
        }