28#include <guichan/color.hpp>
29#include <guichan/graphics.hpp>
90 virtual void updateSize(
int width,
int height,
float scale);
92 using gcn::Graphics::drawImage;
121 int width,
int height,
122 int desiredWidth,
int desiredHeight,
123 bool useColor =
false) = 0;
129 float dstX,
float dstY,
130 int width,
int height,
131 float desiredWidth,
float desiredHeight,
132 bool useColor =
false);
143 int width,
int height,
144 bool useColor =
false);
154 float dstX,
float dstY,
155 int width,
int height,
156 bool useColor =
false);
180 int scaledHeight) = 0;
190 drawImageRect(imgRect, area.x, area.y, area.width, area.height);
193 using gcn::Graphics::drawText;
195 void drawText(
const std::string &text,
197 gcn::Graphics::Alignment alignment,
198 const gcn::Color &color,
200 bool outline =
false,
202 const std::optional<gcn::Color> &outlineColor = {},
203 const std::optional<gcn::Color> &shadowColor = {});
205 void drawText(
const std::string &text,
208 gcn::Graphics::Alignment align,
238 float &logicalX,
float &logicalY)
const = 0;
253 int width,
int height)
override {}
A central point of control for graphics.
virtual void updateScreen()=0
Updates the screen.
virtual void drawImagePattern(const Image *image, int x, int y, int w, int h)
float getScale() const
Returns the graphics scale.
void drawImageRect(const ImageRect &imgRect, const gcn::Rectangle &area)
std::stack< gcn::Rectangle > mClipRects
bool drawImageF(const Image *image, float x, float y)
Blits an image onto the screen.
gcn::Font * getFont() const
virtual bool drawRescaledImage(const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, int desiredWidth, int desiredHeight, bool useColor=false)=0
Draws a rescaled version of the image.
void drawImageRect(const ImageRect &imgRect, int x, int y, int w, int h)
Draws a rectangle using images.
bool drawRescaledImage(const Image *image, int x, int y, int width, int height)
Draws a rescaled version of the image.
virtual SDL_Surface * getScreenshot()=0
Takes a screenshot and returns it as SDL surface.
void drawRescaledImagePattern(const Image *image, int x, int y, int w, int h, int scaledWidth, int scaledHeight)
Draw a pattern based on a rescaled version of the given image.
int getHeight() const
Returns the logical height of the screen.
virtual void drawRescaledImagePattern(const Image *image, int srcX, int srcY, int srcW, int srcH, int dstX, int dstY, int dstW, int dstH, int scaledWidth, int scaledHeight)=0
Draw a pattern based on a rescaled version of the given image.
void drawText(const std::string &text, int x, int y, gcn::Graphics::Alignment alignment, const gcn::Color &color, gcn::Font *font, bool outline=false, bool shadow=false, const std::optional< gcn::Color > &outlineColor={}, const std::optional< gcn::Color > &shadowColor={})
void setColor(const gcn::Color &color) override
virtual void updateClipRect()=0
virtual void windowToLogical(int windowX, int windowY, float &logicalX, float &logicalY) const =0
Converts a window coordinate to a logical coordinate.
const gcn::Color & getColor() const final
bool drawImage(const Image *image, int x, int y)
Blits an image onto the screen.
void pushClipRect(const gcn::Rectangle &rect)
void _beginDraw() override
virtual void updateSize(int width, int height, float scale)
Called when the window size or scale has changed.
virtual void setVSync(bool sync)=0
Sets whether vertical refresh syncing is enabled.
void drawImage(const gcn::Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) override
int getWidth() const
Returns the logical width of the screen.
virtual bool drawRescaledImageF(const Image *image, int srcX, int srcY, float dstX, float dstY, int width, int height, float desiredWidth, float desiredHeight, bool useColor=false)
Draws a rescaled version of the image.
Defines a class for loading and storing images.
An image reference along with the margins specifying how to render this image at different sizes.
std::unique_ptr< Image > image