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::BattlescapeMessage Class Reference

Generic window used to display messages over the Battlescape map. More...

#include <BattlescapeMessage.h>

Inheritance diagram for OpenXcom::BattlescapeMessage:
OpenXcom::Surface

Public Member Functions

 BattlescapeMessage (int width, int height, int x=0, int y=0)
 Creates a new Battlescape message with the specified size and position. More...
 
 ~BattlescapeMessage ()
 Cleans up the Battlescape message. More...
 
void setX (int x)
 Sets the X position of the surface. More...
 
void setY (int y)
 Sets the Y position of the surface. More...
 
void setBackground (Surface *background)
 Sets the Battlescape message's background. More...
 
void setText (const std::wstring &message)
 Sets the Battlescape message's text. More...
 
void initText (Font *big, Font *small, Language *lang)
 Initializes the Battlescape message's resources. More...
 
void setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256)
 Sets the Battlescape message's palette. More...
 
void blit (Surface *surface)
 Blits the warning message.
 
void setHeight (int height)
 Special handling for setting the height of the battlescape message.
 
- Public Member Functions inherited from OpenXcom::Surface
 Surface (int width, int height, int x=0, int y=0, int bpp=8)
 Creates a new surface with the specified size and position. More...
 
 Surface (const Surface &other)
 Creates a new surface from an existing one. More...
 
virtual ~Surface ()
 Cleans up the surface. More...
 
void loadScr (const std::string &filename)
 Loads an X-Com SCR graphic. More...
 
void loadSpk (const std::string &filename)
 Loads an X-Com SPK graphic. More...
 
void loadBdy (const std::string &filename)
 Loads a TFTD BDY graphic. More...
 
void loadImage (const std::string &filename)
 Loads a general image file. More...
 
void clear ()
 Clears the surface's contents. More...
 
void offset (int off, int min=-1, int max=-1, int mul=1)
 Offsets the surface's colors by a set amount. More...
 
void invert (Uint8 mid)
 Inverts the surface's colors. More...
 
virtual void think ()
 Runs surface functionality every cycle. More...
 
virtual void draw ()
 Draws the surface's graphic. More...
 
void copy (Surface *surface)
 Copies a portion of another surface into this one. More...
 
void drawRect (SDL_Rect *rect, Uint8 color)
 Draws a filled rectangle on the surface. More...
 
void drawRect (Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 color)
 Draws a filled rectangle on the surface. More...
 
void drawLine (Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 color)
 Draws a line on the surface. More...
 
void drawCircle (Sint16 x, Sint16 y, Sint16 r, Uint8 color)
 Draws a filled circle on the surface. More...
 
void drawPolygon (Sint16 *x, Sint16 *y, int n, Uint8 color)
 Draws a filled polygon on the surface. More...
 
void drawTexturedPolygon (Sint16 *x, Sint16 *y, int n, Surface *texture, int dx, int dy)
 Draws a textured polygon on the surface. More...
 
void drawString (Sint16 x, Sint16 y, const char *s, Uint8 color)
 Draws a string on the surface. More...
 
SDL_Color * getPalette () const
 Returns the surface's 8bpp palette. More...
 
int getX () const
 Returns the position of the surface in the X axis. More...
 
int getY () const
 Returns the position of the surface in the Y axis. More...
 
void setVisible (bool visible)
 Sets the surface's visibility. More...
 
bool getVisible () const
 Gets the surface's visibility. More...
 
void resetCrop ()
 Resets the cropping rectangle for the surface. More...
 
SDL_Rect * getCrop ()
 Gets the cropping rectangle for the surface. More...
 
void setPixel (int x, int y, Uint8 pixel)
 Changes the color of a pixel in the surface, relative to the top-left corner of the surface. More...
 
void setPixelIterative (int *x, int *y, Uint8 pixel)
 Changes the color of a pixel in the surface and returns the next pixel position. More...
 
Uint8 getPixel (int x, int y) const
 Returns the color of a specified pixel in the surface. More...
 
SDL_Surface * getSurface () const
 Returns the internal SDL_Surface for SDL calls. More...
 
int getWidth () const
 Returns the width of the surface. More...
 
virtual void setWidth (int width)
 Sets the width of the surface. More...
 
int getHeight () const
 Returns the height of the surface. More...
 
void setHidden (bool hidden)
 Sets the surface's special hidden flag. More...
 
void lock ()
 Locks the surface. More...
 
void unlock ()
 Unlocks the surface. More...
 
void blitNShade (Surface *surface, int x, int y, int off, bool half=false, int newBaseColor=0)
 Specific blit function to blit battlescape terrain data in different shades in a fast way. More...
 
void invalidate ()
 Invalidate the surface: force it to be redrawn. More...
 
std::string getTooltip () const
 Gets the tooltip of the surface. More...
 
void setTooltip (const std::string &tooltip)
 Sets the tooltip of the surface. More...
 

Additional Inherited Members

- Protected Member Functions inherited from OpenXcom::Surface
void resize (int width, int height)
 Recreates the surface with a new size. More...
 

Detailed Description

Generic window used to display messages over the Battlescape map.

Constructor & Destructor Documentation

OpenXcom::BattlescapeMessage::BattlescapeMessage ( int  width,
int  height,
int  x = 0,
int  y = 0 
)

Creates a new Battlescape message with the specified size and position.

Sets up a blank Battlescape message with the specified size and position.

Parameters
widthWidth in pixels.
heightHeight in pixels.
xX position in pixels.
yY position in pixels.
OpenXcom::BattlescapeMessage::~BattlescapeMessage ( )

Cleans up the Battlescape message.

Deletes surfaces.

Member Function Documentation

void OpenXcom::BattlescapeMessage::initText ( Font big,
Font small,
Language lang 
)
virtual

Initializes the Battlescape message's resources.

Changes the various resources needed for text rendering.

The different fonts need to be passed in advance since the text size can change mid-text, and the language affects how the text is rendered.

Parameters
bigPointer to large-size font.
smallPointer to small-size font.
langPointer to current language.

Reimplemented from OpenXcom::Surface.

void OpenXcom::BattlescapeMessage::setBackground ( Surface background)

Sets the Battlescape message's background.

Changes the message background.

Parameters
backgroundPointer to background surface.
void OpenXcom::BattlescapeMessage::setPalette ( SDL_Color *  colors,
int  firstcolor = 0,
int  ncolors = 256 
)
virtual

Sets the Battlescape message's palette.

Replaces a certain amount of colors in the surface's palette.

Parameters
colorsPointer to the set of colors.
firstcolorOffset of the first color to replace.
ncolorsAmount of colors to replace.

Reimplemented from OpenXcom::Surface.

void OpenXcom::BattlescapeMessage::setText ( const std::wstring &  message)

Sets the Battlescape message's text.

Changes the message text.

Parameters
messageMessage string.
void OpenXcom::BattlescapeMessage::setX ( int  x)
virtual

Sets the X position of the surface.

Changes the position of the surface in the X axis.

Parameters
xX position in pixels.

Reimplemented from OpenXcom::Surface.

void OpenXcom::BattlescapeMessage::setY ( int  y)
virtual

Sets the Y position of the surface.

Changes the position of the surface in the Y axis.

Parameters
yY position in pixels.

Reimplemented from OpenXcom::Surface.


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