____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       A futuristic real-time strategy game.
          This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project. Distributed under the "GNU General Public License"

cursor.cpp File Reference

The cursors. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "video.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "cursor.h"
#include "map.h"
#include "interface.h"
#include "ui.h"
#include "editor.h"
#include "intern_video.h"

Go to the source code of this file.

Functions

void LoadCursors ()
 < Load all cursors
CCursorCursorByIdent (const std::string &ident)
 Draw any cursor.
static void DrawVisibleRectangleCursor (int x, int y, int x1, int y1)
static void DrawBuildingCursor (void)
void DrawCursor (void)
 Hide the cursor.
void HideCursor (void)
 Animate the cursor.
void CursorAnimate (unsigned ticks)
 Initialize the cursor module.
void InitVideoCursors (void)
 Cleanup the cursor module.
void CleanCursors (void)

Variables

std::vector< CCursorAllCursors
 cursor-types description
CursorStates CursorState
 current cursor state (point,...)
int CursorAction
 action for selection
int CursorValue
 value for CursorAction (spell type f.e.)
int CursorX
 cursor position on screen X
int CursorY
 cursor position on screen Y
int CursorStartX
 rectangle started on screen X
int CursorStartY
 rectangle started on screen Y
int SubScrollX
 pixels the mouse moved while scrolling
int SubScrollY
 pixels the mouse moved while scrolling
int CursorStartScrMapX
 Y position of starting point of selection rectangle, in screen pixels.
int CursorStartScrMapY
 the same in screen map coordinate system
CUnitTypeCursorBuilding
 building cursor
CCursorGameCursor
 current shown cursor-type
static SDL_Surface * HiddenSurface


Detailed Description

The cursors.

Definition in file cursor.cpp.


Function Documentation

void CleanCursors ( void   ) 

Cleanup cursor module

Definition at line 371 of file cursor.cpp.

References AllCursors, CGraphic::Free(), NoUnitP, and UnitUnderCursor.

Referenced by CleanModules().

void CursorAnimate ( unsigned  ticks  ) 

Initialize the cursor module.

Animate the cursor.

Parameters:
ticks Current tick

Definition at line 345 of file cursor.cpp.

References CCursor::FrameRate, CCursor::G, CGraphic::NumFrames, and CCursor::SpriteFrame.

Referenced by WaitEventsOneFrame().

CCursor* CursorByIdent ( const std::string &  ident  ) 

Draw any cursor.

Find the cursor of this identifier.

Parameters:
ident Identifier for the cursor (from config files).
Returns:
Returns the matching cursor.
Note:
If we have more cursors, we should add hash to find them faster.

Definition at line 122 of file cursor.cpp.

References _C_, AllCursors, and DebugPrint.

Referenced by CclSetGameCursor(), and CursorConfig::Load().

static void DrawBuildingCursor ( void   )  [static]

void DrawCursor ( void   ) 

static void DrawVisibleRectangleCursor ( int  x,
int  y,
int  x1,
int  y1 
) [static]

Draw rectangle cursor when visible

Parameters:
x Screen x start position of rectangle
y Screen y start position of rectangle
x1 Screen x end position of rectangle
y1 Screen y end position of rectangle

Definition at line 144 of file cursor.cpp.

References ColorGreen, CVideo::DrawRectangleClip(), CViewport::EndX, CViewport::EndY, CUserInterface::SelectedViewport, UI, Video, CViewport::X, and CViewport::Y.

Referenced by DrawCursor().

void HideCursor ( void   ) 

Animate the cursor.

Hide the cursor

Definition at line 327 of file cursor.cpp.

References CursorX, CursorY, Editor, GameRunning, HiddenSurface, CCursor::HotX, CCursor::HotY, PatchEditorRunning, CEditor::Running, TheScreen, and UseOpenGL.

Referenced by RealizeVideoMemory().

void InitVideoCursors ( void   ) 

Cleanup the cursor module.

Setup the cursor part.

Definition at line 364 of file cursor.cpp.

Referenced by InitModules(), and PreMenuSetup().

void LoadCursors (  ) 

< Load all cursors

Load all cursor sprites.

Definition at line 100 of file cursor.cpp.

References AllCursors, and ShowLoadProgress().

Referenced by CreateGame(), LoadModules(), and PreMenuSetup().


Variable Documentation

std::vector<CCursor> AllCursors

cursor-types description

Define cursor-types.

Todo:
FIXME: Should this be move to ui part?

Definition at line 62 of file cursor.cpp.

Referenced by CclDefineCursor(), CleanCursors(), CursorByIdent(), and LoadCursors().

action for selection

Definition at line 65 of file cursor.cpp.

Referenced by CButtonPanel::DoClicked(), and SendCommand().

Y position of starting point of selection rectangle, in screen pixels.

the same in screen map coordinate system

Definition at line 80 of file cursor.cpp.

Referenced by DrawCursor(), UIHandleButtonDown(), and UIHandleButtonUp().

the same in screen map coordinate system

Definition at line 81 of file cursor.cpp.

Referenced by DrawCursor(), UIHandleButtonDown(), and UIHandleButtonUp().

value for CursorAction (spell type f.e.)

value for action (spell type f.e.)

Definition at line 66 of file cursor.cpp.

Referenced by CButtonPanel::DoClicked(), and SendSpellCast().

int CursorX

int CursorY

SDL_Surface* HiddenSurface [static]

Definition at line 91 of file cursor.cpp.

Referenced by DrawCursor(), and HideCursor().

pixels the mouse moved while scrolling

Definition at line 75 of file cursor.cpp.

pixels the mouse moved while scrolling

X position of starting point of selection rectangle, in screen pixels.

Definition at line 76 of file cursor.cpp.


Generated on Sat Feb 21 00:28:16 2009 for Bos Wars by  doxygen 1.5.6