_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

cursor.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 1998-2005 by Lutz Sammer
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __CURSOR_H__
31 #define __CURSOR_H__
32 
34 
35 /*----------------------------------------------------------------------------
36 -- Documentation
37 ----------------------------------------------------------------------------*/
38 
105 /*----------------------------------------------------------------------------
106 -- Includes
107 ----------------------------------------------------------------------------*/
108 
109 #include <SDL.h>
110 #include <vec2i.h>
111 
112 /*----------------------------------------------------------------------------
113 -- Declarations
114 ----------------------------------------------------------------------------*/
115 
116 class CGraphic;
117 class CUnitType;
118 
119 /*----------------------------------------------------------------------------
120 -- Definitions
121 ----------------------------------------------------------------------------*/
122 
124 class CCursor
125 {
126 public:
127  CCursor() : HotPos(0, 0),
128  SpriteFrame(0), FrameRate(0), G(NULL) {}
129 
130  ~CCursor();
131 
132  std::string Ident;
133  std::string Race;
134 
136 
137  unsigned int SpriteFrame;
138  int FrameRate;
139 
140  // --- FILLED UP ---
141 
143 
144  SDL_Cursor *GetSDLCursor();
145  void Reset(); // Clear all cursor surfaces
146 
147 private:
148  std::vector<SDL_Cursor*> SdlCursors;
149  std::vector<SDL_Surface*> SdlCursorSurfaces;
150 };
151 
154 {
155 public:
156  CursorConfig() : Cursor(NULL) {}
157 
158  void Load();
159 
160  std::string Name;
162 };
163 
170 };
171 
172 /*----------------------------------------------------------------------------
173 -- Variables
174 ----------------------------------------------------------------------------*/
175 
176 extern CursorStates CursorState;
177 extern int CursorAction;
178 extern int CursorValue;
179 extern CUnitType *CursorBuilding;
180 extern std::string CustomCursor;
181 
182 extern CCursor *GameCursor;
183 extern PixelPos CursorScreenPos;
186 
187 /*----------------------------------------------------------------------------
188 -- Functions
189 ----------------------------------------------------------------------------*/
190 
192 extern void LoadCursors(const std::string &racename);
193 
195 extern CCursor *CursorByIdent(const std::string &ident);
196 
198 extern void DrawCursor();
200 extern void HideCursor();
202 extern void CursorAnimate(unsigned ticks);
203 
205 extern void InitVideoCursors();
207 extern void CleanCursors();
208 
209 extern void CursorCclRegister();
210 
212 
213 #endif // !__CURSOR_H__
CursorStateSelect
@ CursorStateSelect
Normal cursor.
Definition: cursor.h:167
CCursor::CCursor
CCursor()
Definition: cursor.h:127
CCursor::FrameRate
int FrameRate
Current displayed cursor frame.
Definition: cursor.h:138
LoadCursors
void LoadCursors(const std::string &racename)
the same in screen map coordinate system
Definition: cursor.cpp:164
CursorAnimate
void CursorAnimate(unsigned ticks)
Animate the cursor.
Definition: cursor.cpp:411
CCursor::GetSDLCursor
SDL_Cursor * GetSDLCursor()
Cursor sprite image.
Definition: cursor.cpp:97
CursorConfig::Cursor
CCursor * Cursor
Config cursor-type name.
Definition: cursor.h:161
CCursor::Ident
std::string Ident
Definition: cursor.h:132
CCursor::HotPos
PixelPos HotPos
Race name.
Definition: cursor.h:135
CleanCursors
void CleanCursors()
Cleanup the cursor module.
Definition: cursor.cpp:437
vec2i.h
CursorCclRegister
void CursorCclRegister()
Definition: cursor.cpp:539
CUnitType
Definition: unittype.h:508
CursorStartScreenPos
PixelPos CursorStartScreenPos
cursor position on screen
Definition: cursor.cpp:76
InitVideoCursors
void InitVideoCursors()
Initialize the cursor module.
Definition: cursor.cpp:430
CursorValue
int CursorValue
action for selection
Definition: cursor.cpp:71
Vec2T< int >
CursorAction
int CursorAction
current cursor state (point,...)
Definition: cursor.cpp:70
CursorConfig::CursorConfig
CursorConfig()
Definition: cursor.h:156
CustomCursor
std::string CustomCursor
building cursor
Definition: cursor.cpp:72
CCursor::SpriteFrame
unsigned int SpriteFrame
Hot point.
Definition: cursor.h:137
CursorStatePieMenu
@ CursorStatePieMenu
Rectangle selecting.
Definition: cursor.h:169
CursorStartMapPos
PixelPos CursorStartMapPos
rectangle started on screen
Definition: cursor.cpp:77
CursorConfig::Load
void Load()
Definition: ui.cpp:249
CursorStates
CursorStates
Cursor state.
Definition: cursor.h:165
CursorStateRectangle
@ CursorStateRectangle
Select position.
Definition: cursor.h:168
CCursor
Private type which specifies the cursor-type.
Definition: cursor.h:124
CursorScreenPos
PixelPos CursorScreenPos
cursor-type
Definition: cursor.cpp:75
CursorBuilding
CUnitType * CursorBuilding
value for action (spell type f.e.)
Definition: cursor.cpp:81
CursorState
CursorStates CursorState
Definition: cursor.cpp:69
CCursor::Race
std::string Race
Identifier to reference it.
Definition: cursor.h:133
DrawCursor
void DrawCursor()
Draw any cursor.
Definition: cursor.cpp:314
CursorByIdent
CCursor * CursorByIdent(const std::string &ident)
Cursor by identifier.
Definition: cursor.cpp:190
CursorStatePoint
@ CursorStatePoint
Definition: cursor.h:166
HideCursor
void HideCursor()
Hide the cursor.
Definition: cursor.cpp:394
CursorConfig
Cursor config reference.
Definition: cursor.h:153
GameCursor
CCursor * GameCursor
custom cursor for button
Definition: cursor.cpp:85
CCursor::~CCursor
~CCursor()
Definition: cursor.cpp:138
CCursor::G
CGraphic * G
Rate of changing the frames.
Definition: cursor.h:142
CCursor::Reset
void Reset()
Definition: cursor.cpp:148
CursorConfig::Name
std::string Name
Definition: cursor.h:160
CGraphic
Definition: video.h:91
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.