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

cursor.cpp File Reference
#include "stratagus.h"
#include "cursor.h"
#include "intern_video.h"
#include "editor.h"
#include "interface.h"
#include "map.h"
#include "settings.h"
#include "tileset.h"
#include "translate.h"
#include "ui.h"
#include "unit.h"
#include "unittype.h"
#include "video.h"
#include <vector>

cursor.cpp - The cursors.

static std::vector< CCursor * > AllCursors
 
uint8_t SizeChangeCounter
 Just a counter to cache window data on in other places when the size changes. More...
 
static uint8_t LastSizeVersion
 
CursorStates CursorState
 
int CursorAction
 current cursor state (point,...) More...
 
int CursorValue
 action for selection More...
 
std::string CustomCursor
 value for CursorAction (spell type f.e.) More...
 
PixelPos CursorScreenPos
 custom cursor for button More...
 
PixelPos CursorStartScreenPos
 cursor position on screen More...
 
PixelPos CursorStartMapPos
 rectangle started on screen More...
 
CUnitTypeCursorBuilding
 position of starting point of selection rectangle, in Map pixels. More...
 
CCursorGameCursor
 building cursor More...
 
static CCursorActuallyVisibleGameCursor
 current shown cursor-type More...
 
static int VisibleGameCursorFrame
 
static SDL_Surface * HiddenSurface
 
void LoadCursors (const std::string &race)
 the same in screen map coordinate system More...
 
CCursorCursorByIdent (const std::string &ident)
 Cursor by identifier. More...
 
static void DrawVisibleRectangleCursor (PixelPos corner1, PixelPos corner2)
 
static void DrawBuildingCursor ()
 
void DrawCursor ()
 Draw any cursor. More...
 
void HideCursor ()
 Hide the cursor. More...
 
void CursorAnimate (unsigned ticks)
 Animate the cursor. More...
 
void InitVideoCursors ()
 Initialize the cursor module. More...
 
void CleanCursors ()
 Cleanup the cursor module. More...
 
static int CclDefineCursor (lua_State *l)
 
static int CclSetGameCursor (lua_State *l)
 
void CursorCclRegister ()
 

Function Documentation

◆ CclDefineCursor()

static int CclDefineCursor ( lua_State *  l)
static

Define a cursor.

Parameters
lLua state.

◆ CclSetGameCursor()

static int CclSetGameCursor ( lua_State *  l)
static

Set the current game cursor.

Parameters
lLua state.

◆ CleanCursors()

void CleanCursors ( )

Cleanup the cursor module.

Cleanup cursor module

◆ CursorAnimate()

void CursorAnimate ( unsigned  ticks)

Animate the cursor.

Animate the cursor.

Parameters
ticksCurrent tick

◆ CursorByIdent()

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

Cursor by identifier.

Find the cursor of this identifier.

Parameters
identIdentifier 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.

◆ CursorCclRegister()

void CursorCclRegister ( )

◆ DrawBuildingCursor()

static void DrawBuildingCursor ( )
static

Draw cursor for selecting building position.

◆ DrawCursor()

void DrawCursor ( )

Draw any cursor.

Draw the cursor.

◆ DrawVisibleRectangleCursor()

static void DrawVisibleRectangleCursor ( PixelPos  corner1,
PixelPos  corner2 
)
static

Draw rectangle cursor when visible

Parameters
corner1Screen start position of rectangle
corner2Screen end position of rectangle

◆ HideCursor()

void HideCursor ( )

Hide the cursor.

Hide the cursor

◆ InitVideoCursors()

void InitVideoCursors ( )

Initialize the cursor module.

Setup the cursor part.

◆ LoadCursors()

void LoadCursors ( const std::string &  race)

the same in screen map coordinate system

Load all cursor sprites.

Parameters
raceCursor graphics of this race to load.

Variable Documentation

◆ ActuallyVisibleGameCursor

CCursor* ActuallyVisibleGameCursor
static

current shown cursor-type

◆ AllCursors

std::vector<CCursor *> AllCursors
static

Define cursor-types.

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

◆ CursorAction

int CursorAction

current cursor state (point,...)

◆ CursorBuilding

CUnitType* CursorBuilding

position of starting point of selection rectangle, in Map pixels.

value for action (spell type f.e.)

◆ CursorScreenPos

PixelPos CursorScreenPos

custom cursor for button

cursor-type

◆ CursorStartMapPos

PixelPos CursorStartMapPos

rectangle started on screen

◆ CursorStartScreenPos

PixelPos CursorStartScreenPos

cursor position on screen

◆ CursorState

CursorStates CursorState

◆ CursorValue

int CursorValue

action for selection

◆ CustomCursor

std::string CustomCursor

value for CursorAction (spell type f.e.)

building cursor

◆ GameCursor

CCursor* GameCursor

building cursor

custom cursor for button

◆ HiddenSurface

SDL_Surface* HiddenSurface
static

◆ LastSizeVersion

uint8_t LastSizeVersion
static

◆ SizeChangeCounter

uint8_t SizeChangeCounter

Just a counter to cache window data on in other places when the size changes.

◆ VisibleGameCursorFrame

int VisibleGameCursorFrame
static
(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.