![]() |
OpenXcom
1.0
Open-source clone of the original X-Com
|
Bar graphic that represents a certain value. More...
#include <Bar.h>
Public Member Functions | |
| Bar (int width, int height, int x=0, int y=0) | |
| Creates a new bar with the specified size and position. More... | |
| ~Bar () | |
| Cleans up the bar. | |
| void | setColor (Uint8 color) |
| Sets the bar's color. More... | |
| Uint8 | getColor () const |
| Gets the bar's color. More... | |
| void | setSecondaryColor (Uint8 color) |
| Sets the bar's second color. More... | |
| Uint8 | getSecondaryColor () const |
| Gets the bar's second color. More... | |
| void | setScale (double scale) |
| Sets the bar's scale. More... | |
| double | getScale () const |
| Gets the bar's scale. More... | |
| void | setMax (double max) |
| Sets the bar's maximum value. More... | |
| double | getMax () const |
| Gets the bar's maximum value. More... | |
| void | setValue (double value) |
| Sets the bar's current value. More... | |
| double | getValue () const |
| Gets the bar's current value. More... | |
| void | setValue2 (double value) |
| Sets the bar's second current value. More... | |
| double | getValue2 () const |
| Gets the bar's second current value. More... | |
| void | setSecondValueOnTop (bool onTop) |
| Defines whether the second value should be drawn on top. More... | |
| void | draw () |
| Draws the bar. More... | |
| void | setBorderColor (Uint8 bc) |
| set the outline color for the bar. More... | |
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 | loadRaw (const std::vector< unsigned char > &bytes) |
| Loads a raw pixel array. More... | |
| void | loadRaw (const std::vector< char > &bytes) |
| Loads a raw pixel array. 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 (Uint32 color=0) |
| Clears the surface's contents eith a specified colour. 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 | offsetBlock (int off, int blk=16, int mul=1) |
| Offsets the surface's colors in a color block. More... | |
| void | invert (Uint8 mid) |
| Inverts the surface's colors. More... | |
| virtual void | think () |
| Runs surface functionality every cycle. More... | |
| virtual void | blit (Surface *surface) |
| Blits this surface onto another one. More... | |
| virtual void | initText (Font *, Font *, Language *) |
| Initializes the surface's various text resources. | |
| 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... | |
| virtual void | setPalette (SDL_Color *colors, int firstcolor=0, int ncolors=256) |
| Sets the surface's palette. More... | |
| SDL_Color * | getPalette () const |
| Returns the surface's 8bpp palette. More... | |
| virtual void | setX (int x) |
| Sets the X position of the surface. More... | |
| int | getX () const |
| Returns the position of the surface in the X axis. More... | |
| virtual void | setY (int y) |
| Sets the Y position of the surface. More... | |
| int | getY () const |
| Returns the position of the surface in the Y axis. More... | |
| virtual 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... | |
| Uint8 * | getRaw (int x, int y) const |
| Returns the pointer to 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... | |
| virtual void | setHeight (int height) |
| Sets 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 shade, bool half=false, int newBaseColor=0) |
| Specific blit function to blit battlescape terrain data in different shades in a fast way. More... | |
| void | blitNShade (Surface *surface, int x, int y, int shade, GraphSubset range) |
| Specific blit function to blit battlescape terrain data in different shades in a fast way. More... | |
| void | invalidate (bool valid=true) |
| 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... | |
| virtual void | setHighContrast (bool) |
| Sets the high contrast color setting of the surface. | |
| void | setTFTDMode (bool mode) |
| Sets this button to use a colour lookup table instead of inversion for its alternate form. More... | |
| bool | isTFTDMode () const |
| checks if this is a TFTD mode surface. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from OpenXcom::Surface | |
| template<typename T > | |
| void | rawCopy (const std::vector< T > &bytes) |
| Copies raw pixels. More... | |
| void | resize (int width, int height) |
| Resizes the surface. More... | |
Bar graphic that represents a certain value.
Drawn with a coloured border and partially filled content to contrast two values, typically used for showing base and soldier stats.
| OpenXcom::Bar::Bar | ( | int | width, |
| int | height, | ||
| int | x = 0, |
||
| int | y = 0 |
||
| ) |
Creates a new bar with the specified size and position.
Sets up a blank bar with the specified size and position.
| width | Width in pixels. |
| height | Height in pixels. |
| x | X position in pixels. |
| y | Y position in pixels. |
|
virtual |
Draws the bar.
Draws the bordered bar filled according to its values.
Reimplemented from OpenXcom::Surface.
| Uint8 OpenXcom::Bar::getColor | ( | ) | const |
Gets the bar's color.
Returns the color used to draw the bar.
| double OpenXcom::Bar::getMax | ( | ) | const |
Gets the bar's maximum value.
Returns the maximum value used to draw the outer border.
| double OpenXcom::Bar::getScale | ( | ) | const |
Gets the bar's scale.
Returns the scale factor used to draw the bar values.
| Uint8 OpenXcom::Bar::getSecondaryColor | ( | ) | const |
Gets the bar's second color.
Returns the second color used to draw the bar.
| double OpenXcom::Bar::getValue | ( | ) | const |
Gets the bar's current value.
Returns the value used to draw the inner contents.
| double OpenXcom::Bar::getValue2 | ( | ) | const |
Gets the bar's second current value.
Returns the value used to draw the second inner contents.
|
virtual |
set the outline color for the bar.
sets the border color for the bar.
| bc | the color for the outline of the bar. |
Reimplemented from OpenXcom::Surface.
|
virtual |
Sets the bar's color.
Changes the color used to draw the border and contents.
| color | Color value. |
Reimplemented from OpenXcom::Surface.
| void OpenXcom::Bar::setMax | ( | double | max | ) |
Sets the bar's maximum value.
Changes the maximum value used to draw the outer border.
| max | Maximum value. |
| void OpenXcom::Bar::setScale | ( | double | scale | ) |
Sets the bar's scale.
Changes the scale factor used to draw the bar values.
| scale | Scale in pixels/unit. |
|
virtual |
Sets the bar's second color.
Changes the color used to draw the second contents.
| color | Color value. |
Reimplemented from OpenXcom::Surface.
| void OpenXcom::Bar::setSecondValueOnTop | ( | bool | onTop | ) |
Defines whether the second value should be drawn on top.
Default this is true.
| onTop | Second value on top? |
| void OpenXcom::Bar::setValue | ( | double | value | ) |
Sets the bar's current value.
Changes the value used to draw the inner contents.
| value | Current value. |
| void OpenXcom::Bar::setValue2 | ( | double | value | ) |
Sets the bar's second current value.
Changes the value used to draw the second inner contents.
| value | Current value. |
1.8.14