src/interface/mouse.h

Go to the documentation of this file.
00001 /******************************************************************************
00002  *  Wormux is a convivial mass murder game.
00003  *  Copyright (C) 2001-2004 Lawrence Azzoug.
00004  *
00005  *  This program is free software; you can redistribute it and/or modify
00006  *  it under the terms of the GNU General Public License as published by
00007  *  the Free Software Foundation; either version 2 of the License, or
00008  *  (at your option) any later version.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
00018  ******************************************************************************
00019  * Mouse management
00020  *****************************************************************************/
00021 
00022 #ifndef MOUSE_H
00023 #define MOUSE_H
00024 
00025 #include <SDL.h>
00026 #include "../graphic/surface.h"
00027 #include "../include/app.h"
00028 #include "../include/base.h"
00029 #include "../tool/point.h"
00030 
00031 class Mouse
00032 {
00033 public:
00034   typedef enum {
00035     POINTER_STANDARD,
00036     POINTER_SELECT,
00037     POINTER_MOVE,
00038     POINTER_AIM
00039   } pointer_t;
00040 
00041 private:
00042   bool scroll_actif;
00043   bool hide;
00044   pointer_t current_pointer;
00045 
00046   Point2i savedPos;
00047   Point2i lastPos;
00048 
00049   static Mouse * singleton;
00050 
00051   Surface pointer_select, pointer_move, pointer_aim;
00052 
00053   Mouse();
00054   bool ScrollPointer();
00055   bool DrawMovePointer();
00056 
00057 public:
00058 
00059   static Mouse * GetInstance();
00060 
00061   void TraiteClic (const SDL_Event *event);
00062 
00063   void Reset();
00064 
00065   void Refresh();
00066   void TestCamera();
00067   bool ActionClicG();
00068   bool ActionClicD();
00069   bool ActionWhellDown();
00070   bool ActionWhellUp();
00071   void ChoixVerPointe();
00072 
00073   Point2i GetPosition() const;
00074   Point2i GetWorldPosition() const;
00075   bool ClicG() const;
00076   bool ClicD() const;
00077   bool ClicM() const;
00078   void ScrollCamera();
00079 
00080   // Choose the pointer
00081   pointer_t SetPointer(pointer_t pointer);
00082   void Draw();
00083 
00084   // Hide/show mouse pointer
00085   void Show();
00086   void Hide();
00087   bool IsVisible() const;
00088 
00089   // Center the pointer on the screen
00090   void CenterPointer();
00091 };
00092 
00093 #endif

Generated on Mon Jan 1 13:10:58 2007 for Wormux by  doxygen 1.4.7