39 SDL_Surface *_surface;
41 SDL_Rect _crop, _clear;
42 bool _visible, _hidden, _redraw, _tftdMode;
46 void resize(
int width,
int height);
49 Surface(
int width,
int height,
int x = 0,
int y = 0,
int bpp = 8);
55 void loadScr(
const std::string &filename);
57 void loadSpk(
const std::string &filename);
59 void loadBdy(
const std::string &filename);
61 void loadImage(
const std::string &filename);
63 void clear(Uint32 color = 0);
65 void offset(
int off,
int min = -1,
int max = -1,
int mul = 1);
67 void offsetBlock(
int off,
int blk = 16,
int mul = 1);
81 void drawRect(SDL_Rect *rect, Uint8 color);
83 void drawRect(Sint16 x, Sint16 y, Sint16 w, Sint16 h, Uint8 color);
85 void drawLine(Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 color);
87 void drawCircle(Sint16 x, Sint16 y, Sint16 r, Uint8 color);
89 void drawPolygon(Sint16 *x, Sint16 *y,
int n, Uint8 color);
93 void drawString(Sint16 x, Sint16 y,
const char *s, Uint8 color);
95 virtual void setPalette(SDL_Color *colors,
int firstcolor = 0,
int ncolors = 256);
102 return _surface->format->palette->colors;
105 virtual void setX(
int x);
115 virtual void setY(
int y);
145 ((Uint8 *)_surface->pixels)[y * _surface->pitch + x * _surface->format->BytesPerPixel] = pixel;
177 return ((Uint8 *)_surface->pixels)[y * _surface->pitch + x * _surface->format->BytesPerPixel];
214 void blitNShade(
Surface *surface,
int x,
int y,
int off,
bool half =
false,
int newBaseColor = 0);
virtual void setY(int y)
Sets the Y position of the surface.
Definition: Surface.cpp:765
void drawRect(SDL_Rect *rect, Uint8 color)
Draws a filled rectangle on the surface.
Definition: Surface.cpp:666
int getWidth() const
Returns the width of the surface.
Definition: Surface.h:191
virtual void setSecondaryColor(Uint8)
Sets the secondary color of the surface.
Definition: Surface.h:225
int getHeight() const
Returns the height of the surface.
Definition: Surface.h:201
void drawLine(Sint16 x1, Sint16 y1, Sint16 x2, Sint16 y2, Uint8 color)
Draws a line on the surface.
Definition: Surface.cpp:697
virtual ~Surface()
Cleans up the surface.
Definition: Surface.cpp:208
bool isTFTDMode() const
checks if this is a TFTD mode surface.
Definition: Surface.cpp:1046
virtual void setX(int x)
Sets the X position of the surface.
Definition: Surface.cpp:756
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...
Definition: Surface.cpp:925
std::string getTooltip() const
Gets the tooltip of the surface.
Definition: Surface.cpp:959
virtual void setVisible(bool visible)
Sets the surface's visibility.
Definition: Surface.cpp:775
virtual void setHighContrast(bool)
Sets the high contrast color setting of the surface.
Definition: Surface.h:229
SDL_Color * getPalette() const
Returns the surface's 8bpp palette.
Definition: Surface.h:100
virtual void setColor(Uint8)
Sets the color of the surface.
Definition: Surface.h:223
virtual void draw()
Draws the surface's graphic.
Definition: Surface.cpp:589
void loadImage(const std::string &filename)
Loads a general image file.
Definition: Surface.cpp:251
void offsetBlock(int off, int blk=16, int mul=1)
Offsets the surface's colors in a color block.
Definition: Surface.cpp:502
int getY() const
Returns the position of the surface in the Y axis.
Definition: Surface.h:120
void setTooltip(const std::string &tooltip)
Sets the tooltip of the surface.
Definition: Surface.cpp:969
Contains strings used throughout the game for localization.
Definition: Language.h:39
virtual void setBorderColor(Uint8)
Sets the border colour of the surface.
Definition: Surface.h:227
Takes care of loading and storing each character in a sprite font.
Definition: Font.h:45
void unlock()
Unlocks the surface.
Definition: Surface.cpp:850
SDL_Rect * getCrop()
Gets the cropping rectangle for the surface.
Definition: Surface.cpp:805
virtual void blit(Surface *surface)
Blits this surface onto another one.
Definition: Surface.cpp:602
void drawString(Sint16 x, Sint16 y, const char *s, Uint8 color)
Draws a string on the surface.
Definition: Surface.cpp:747
void loadBdy(const std::string &filename)
Loads a TFTD BDY graphic.
Definition: Surface.cpp:382
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...
Definition: Surface.h:139
void loadSpk(const std::string &filename)
Loads an X-Com SPK graphic.
Definition: Surface.cpp:326
virtual void setPalette(SDL_Color *colors, int firstcolor=0, int ncolors=256)
Sets the surface's palette.
Definition: Surface.cpp:816
Element that is blit (rendered) onto the screen.
Definition: Surface.h:36
int getX() const
Returns the position of the surface in the X axis.
Definition: Surface.h:110
void resize(int width, int height)
Recreates the surface with a new size.
Definition: Surface.cpp:981
virtual void think()
Runs surface functionality every cycle.
Definition: Surface.cpp:578
Surface(int width, int height, int x=0, int y=0, int bpp=8)
Creates a new surface with the specified size and position.
Definition: Surface.cpp:138
SDL_Surface * getSurface() const
Returns the internal SDL_Surface for SDL calls.
Definition: Surface.h:183
void invert(Uint8 mid)
Inverts the surface's colors.
Definition: Surface.cpp:552
void loadScr(const std::string &filename)
Loads an X-Com SCR graphic.
Definition: Surface.cpp:221
void copy(Surface *surface)
Copies a portion of another surface into this one.
Definition: Surface.cpp:632
void drawPolygon(Sint16 *x, Sint16 *y, int n, Uint8 color)
Draws a filled polygon on the surface.
Definition: Surface.cpp:721
void setHidden(bool hidden)
Sets the surface's special hidden flag.
Definition: Surface.cpp:829
void lock()
Locks the surface.
Definition: Surface.cpp:840
bool getVisible() const
Gets the surface's visibility.
Definition: Surface.cpp:784
void setPixelIterative(int *x, int *y, Uint8 pixel)
Changes the color of a pixel in the surface and returns the next pixel position.
Definition: Surface.h:155
Uint8 getPixel(int x, int y) const
Returns the color of a specified pixel in the surface.
Definition: Surface.h:171
void drawCircle(Sint16 x, Sint16 y, Sint16 r, Uint8 color)
Draws a filled circle on the surface.
Definition: Surface.cpp:709
virtual void setWidth(int width)
Sets the width of the surface.
Definition: Surface.cpp:1015
void resetCrop()
Resets the cropping rectangle for the surface.
Definition: Surface.cpp:793
void setTFTDMode(bool mode)
Sets this button to use a colour lookup table instead of inversion for its alternate form...
Definition: Surface.cpp:1037
virtual void initText(Font *, Font *, Language *)
Initializes the surface's various text resources.
Definition: Surface.h:77
void invalidate(bool valid=true)
Invalidate the surface: force it to be redrawn.
Definition: Surface.cpp:949
Definition: BaseInfoState.cpp:40
virtual void setHeight(int height)
Sets the height of the surface.
Definition: Surface.cpp:1027
void offset(int off, int min=-1, int max=-1, int mul=1)
Offsets the surface's colors by a set amount.
Definition: Surface.cpp:452
void drawTexturedPolygon(Sint16 *x, Sint16 *y, int n, Surface *texture, int dx, int dy)
Draws a textured polygon on the surface.
Definition: Surface.cpp:735
void clear(Uint32 color=0)
Clears the surface's contents eith a specified colour.
Definition: Surface.cpp:437