OpenXcom  1.0
Open-source clone of the original X-Com
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
OpenXcom::Action Class Reference

Container for all the information associated with a given user action, like mouse clicks, key presses, etc. More...

#include <Action.h>

Public Member Functions

 Action (SDL_Event *ev, double scaleX, double scaleY, int topBlackBand, int leftBlackBand)
 Creates an action with given event data. More...
 
 ~Action ()
 Cleans up the action.
 
double getXScale () const
 Gets the screen's X scale. More...
 
double getYScale () const
 Gets the screen's Y scale. More...
 
void setMouseAction (int mouseX, int mouseY, int surfaceX, int surfaceY)
 Sets the action as a mouse action. More...
 
bool isMouseAction () const
 Gets if the action is a mouse action.
 
int getTopBlackBand () const
 Gets the top black band height. More...
 
int getLeftBlackBand () const
 Gets the left black band width. More...
 
int getXMouse () const
 Gets the mouse's X position. More...
 
int getYMouse () const
 Gets the mouse's Y position. More...
 
double getAbsoluteXMouse () const
 Gets the mouse's absolute X position. More...
 
double getAbsoluteYMouse () const
 Gets the mouse's absolute Y position. More...
 
double getRelativeXMouse () const
 Gets the mouse's relative X position. More...
 
double getRelativeYMouse () const
 Gets the mouse's relative Y position. More...
 
InteractiveSurfacegetSender () const
 Gets the sender of the action. More...
 
void setSender (InteractiveSurface *sender)
 Sets the sender of the action. More...
 
SDL_Event * getDetails () const
 Gets the details of the action. More...
 

Detailed Description

Container for all the information associated with a given user action, like mouse clicks, key presses, etc.

Note
Called action because event is reserved.

Constructor & Destructor Documentation

OpenXcom::Action::Action ( SDL_Event *  ev,
double  scaleX,
double  scaleY,
int  topBlackBand,
int  leftBlackBand 
)

Creates an action with given event data.

Creates a new action.

Parameters
scaleXScreen's X scaling factor.
scaleYScreen's Y scaling factor.
topBlackBandScreen's top black band height.
leftBlackBandScreen's left black band width.
evPointer to SDL_event.

Member Function Documentation

double OpenXcom::Action::getAbsoluteXMouse ( ) const

Gets the mouse's absolute X position.

Returns the absolute X position of the mouse cursor relative to the game window, corrected for screen scaling.

Returns
Mouse's absolute X position.
double OpenXcom::Action::getAbsoluteYMouse ( ) const

Gets the mouse's absolute Y position.

Returns the absolute Y position of the mouse cursor relative to the game window, corrected for screen scaling.

Returns
Mouse's absolute X position.
SDL_Event * OpenXcom::Action::getDetails ( ) const

Gets the details of the action.

Returns the details about this action.

Returns
Pointer to SDL_event.
int OpenXcom::Action::getLeftBlackBand ( ) const

Gets the left black band width.

Returns the width in pixel of the left black band if any.

Returns
Screen's left black band.
double OpenXcom::Action::getRelativeXMouse ( ) const

Gets the mouse's relative X position.

Returns the relative X position of the mouse cursor relative to the surface that triggered the action, corrected for screen scaling.

Returns
Mouse's relative X position.
double OpenXcom::Action::getRelativeYMouse ( ) const

Gets the mouse's relative Y position.

Returns the relative X position of the mouse cursor relative to the surface that triggered the action, corrected for screen scaling.

Returns
Mouse's relative X position.
InteractiveSurface * OpenXcom::Action::getSender ( ) const

Gets the sender of the action.

Returns the interactive surface that triggered this action (the sender).

Returns
Pointer to interactive surface.
int OpenXcom::Action::getTopBlackBand ( ) const

Gets the top black band height.

Returns the height in pixel of the top black band if any.

Returns
Screen's top black band.
int OpenXcom::Action::getXMouse ( ) const

Gets the mouse's X position.

Returns the X position of the mouse cursor relative to the game window, or -1 if this isn't a mouse-related action.

Returns
Mouse's X position.
double OpenXcom::Action::getXScale ( ) const

Gets the screen's X scale.

Returns the X scaling factor used by the screen when this action was fired (used to correct mouse input).

Returns
Screen's X scaling factor.
int OpenXcom::Action::getYMouse ( ) const

Gets the mouse's Y position.

Returns the Y position of the mouse cursor relative to the game window, or -1 if this isn't a mouse-related action.

Returns
Mouse's Y position.
double OpenXcom::Action::getYScale ( ) const

Gets the screen's Y scale.

Returns the Y scaling factor used by the screen when this action was fired (used to correct mouse input).

Returns
Screen's Y scaling factor.
void OpenXcom::Action::setMouseAction ( int  mouseX,
int  mouseY,
int  surfaceX,
int  surfaceY 
)

Sets the action as a mouse action.

Sets this action as a mouse action with the respective mouse properties.

Parameters
mouseXMouse's X position.
mouseYMouse's Y position.
surfaceXSurface's X position.
surfaceYSurface's Y position.
void OpenXcom::Action::setSender ( InteractiveSurface sender)

Sets the sender of the action.

Changes the interactive surface that triggered this action (the sender).

Parameters
senderPointer to interactive surface.

The documentation for this class was generated from the following files: