K3dMouse.cpp

Go to the documentation of this file.
00001 
00010 /***************************************************************************
00011  *   Copyright (C) 2007 by Jan Koci   *
00012  *   honza.koci@email.cz   *
00013  *   http://kengine.sourceforge.net/tutorial/
00014  *                                                                         *
00015  *   This program is free software; you can redistribute it and/or modify  *
00016  *   it under the terms of the GNU General Public License as published by  *
00017  *   the Free Software Foundation; either version 2 of the License, or     *
00018  *   (at your option) any later version.                                   *
00019  *                                                                         *
00020  *   This program is distributed in the hope that it will be useful,       *
00021  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00022  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00023  *   GNU General Public License for more details.                          *
00024  *                                                                         *
00025  *   You should have received a copy of the GNU General Public License     *
00026  *   along with this program; if not, write to the                         *
00027  *   Free Software Foundation, Inc.,                                       *
00028  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00029  ***************************************************************************/
00030 
00031 #include "K3dMouse.h"
00032 
00033 K3dMouse::K3dMouse(K3dGameData *_pGameData)
00034 {
00035         m_pGameData = _pGameData;
00036         // Set this class to the global data
00037         m_pGameData->SetMouse(this);
00038         m_bIsWheelUp=false;
00039         m_bIsWheelDown = false;
00040         m_iNumWheelDownFrames = 0;
00041         m_iNumWheelUpFrames = 0;
00042         m_aiPosition[0] = 0;
00043         m_aiPosition[1] = 0;
00044         m_aiPositionRel[0] = 0;
00045         m_aiPositionRel[1] = 0;
00046 }
00047 
00048 K3dMouse::~K3dMouse(void)
00049 {
00050 }
00051 
00053 void K3dMouse::UpdateMouse()
00054 {
00055         //SDL_PumpEvents();
00056 
00057         // Calculate frames to wheel up button true only in one frame
00058         if(m_bIsWheelUp)
00059         {       
00060                 m_iNumWheelUpFrames++;
00061                 if(m_iNumWheelUpFrames == 2)
00062                 {
00063                         m_iNumWheelUpFrames = 0;
00064                         m_bIsWheelUp = false;
00065                 }
00066         }
00067         // Calculate frames to wheel down button true only in one frame
00068         if(m_bIsWheelDown)
00069         {       
00070                 m_iNumWheelDownFrames++;
00071                 if(m_iNumWheelDownFrames == 2)
00072                 {
00073                         m_iNumWheelDownFrames = 0;
00074                         m_bIsWheelDown = false;
00075                 }
00076         }
00077 }

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0