Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

CursorManager.h

Go to the documentation of this file.
00001 /*
00002  * CursorManager.h
00003  *
00004  * Part of Fly! Legacy project
00005  *
00006  * Copyright 2003 Chris Wallace
00007  *
00008  * Fly! Legacy is free software; you can redistribute it and/or modify
00009  *   it under the terms of the GNU General Public License as published by
00010  *   the Free Software Foundation; either version 2 of the License, or
00011  *   (at your option) any later version.
00012  *
00013  * Fly! Legacy is distributed in the hope that it will be useful,
00014  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  *   GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  *   along with Fly! Legacy; if not, write to the Free Software
00020  *    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  *
00022  */
00023 
00033 #ifndef CURSORMANAGER_H_
00034 #define CURSORMANAGER_H_
00035 
00036 #include "FlyLegacy.h"
00037 #include <map>
00038 
00039 
00043 class CCursor : public CStreamObject {
00044 public:
00045   CCursor (const char* csrfilename);
00046   ~CCursor (void);
00047 
00048   // CStreamObject methods
00049   int   Read (SStream *stream, Tag tag);
00050   void  ReadFinished (void);
00051 
00052   // CCursor methods
00053   void  Load (const char* pbmName);
00054   void CCursor::FreeTexture (void);
00055 
00056 public:
00057   char          csr[64];          
00058   char          curs[64];         
00059   Tag           csid;             
00060   char          imag[64];         
00061   int           hots_x, hots_y;   
00062 
00063   // GL texture for cursor
00064 //  int           texwidth;         // Texture image width
00065 //  int           texheight;        // Texture image height
00066 //  GLubyte       teximage;         // Texture image data
00067   GLuint        texid;
00068 };
00069 
00070 class CCursorManager {
00071 public:
00072   CCursorManager (void);
00073   ~CCursorManager (void);
00074 
00075   // CCursorManager methods
00076   Tag     BindCursor (const char* csr);
00077   int     GetNumBoundCursors (void);
00078 
00079   void    MouseMotion (int mouse_x, int mouse_y);
00080 
00081   CCursor *FindCursor (const char *csrfilename);
00082   CCursor *FindCursor (Tag tag);
00083 
00084   void    SetCursor (Tag tag);
00085   Tag     GetCursor (void);
00086 
00087   void    Draw (void);
00088 
00089 protected:
00090   std::map<Tag,CCursor*>    cache;    // Cursor cache, indexed by unique ID tag
00091   CCursor   *crsrCurrent;             // Pointer to current cursor
00092   int       x, y;                     // Current mouse position in screen coordinates
00093 };
00094 
00095 #endif // CURSORMANAGER_H
SourceForge.net Logo Documentation generated by doxygen