|
Mana
|
A central point of control for graphics. More...
#include <graphics.h>
Public Member Functions | |
| Graphics ()=default | |
| virtual void | setVSync (bool sync)=0 |
| Sets whether vertical refresh syncing is enabled. | |
| virtual void | updateSize (int width, int height, float scale) |
| Called when the window size or scale has changed. | |
| bool | drawImage (const Image *image, int x, int y) |
| Blits an image onto the screen. | |
| bool | drawImageF (const Image *image, float x, float y) |
| Blits an image onto the screen. | |
| bool | drawRescaledImage (const Image *image, int x, int y, int width, int height) |
| Draws a rescaled version of the image. | |
| 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. | |
| 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. | |
| virtual bool | drawImage (const Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height, bool useColor=false) |
| Blits an image onto the screen. | |
| virtual bool | drawImageF (const Image *image, int srcX, int srcY, float dstX, float dstY, int width, int height, bool useColor=false) |
| Blits an image onto the screen. | |
| virtual void | drawImagePattern (const Image *image, int x, int y, int w, int h) |
| 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. | |
| 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 | drawImageRect (const ImageRect &imgRect, int x, int y, int w, int h) |
| Draws a rectangle using images. | |
| void | drawImageRect (const ImageRect &imgRect, const gcn::Rectangle &area) |
| 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 | drawText (const std::string &text, int x, int y, gcn::Graphics::Alignment align, gcn::Font *font, const TextFormat &format) |
| virtual void | updateScreen ()=0 |
| Updates the screen. | |
| int | getWidth () const |
| Returns the logical width of the screen. | |
| int | getHeight () const |
| Returns the logical height of the screen. | |
| float | getScale () const |
| Returns the graphics scale. | |
| virtual void | windowToLogical (int windowX, int windowY, float &logicalX, float &logicalY) const =0 |
| Converts a window coordinate to a logical coordinate. | |
| void | _beginDraw () override |
| void | _endDraw () override |
| virtual SDL_Surface * | getScreenshot ()=0 |
| Takes a screenshot and returns it as SDL surface. | |
| gcn::Font * | getFont () const |
| void | drawImage (const gcn::Image *image, int srcX, int srcY, int dstX, int dstY, int width, int height) override |
| void | setColor (const gcn::Color &color) override |
| const gcn::Color & | getColor () const final |
| void | pushClipRect (const gcn::Rectangle &rect) |
| void | popClipRect () |
Protected Member Functions | |
| virtual void | updateClipRect ()=0 |
Protected Attributes | |
| int | mWidth = 0 |
| int | mHeight = 0 |
| float | mScale = 1.0f |
| gcn::Color | mColor |
| std::stack< gcn::Rectangle > | mClipRects |
A central point of control for graphics.
Definition at line 77 of file graphics.h.
|
default |
|
override |
Definition at line 242 of file graphics.cpp.
|
override |
Definition at line 247 of file graphics.cpp.
|
inlineoverride |
Definition at line 250 of file graphics.h.
|
virtual |
Blits an image onto the screen.
true if the image was blitted properly false otherwise. Definition at line 77 of file graphics.cpp.
| bool Graphics::drawImage | ( | const Image * | image, |
| int | x, | ||
| int | y | ||
| ) |
Blits an image onto the screen.
true if the image was blitted properly false otherwise. Definition at line 36 of file graphics.cpp.
| bool Graphics::drawImageF | ( | const Image * | image, |
| float | x, | ||
| float | y | ||
| ) |
Blits an image onto the screen.
true if the image was blitted properly false otherwise. Definition at line 44 of file graphics.cpp.
|
virtual |
Blits an image onto the screen.
true if the image was blitted properly false otherwise. Definition at line 90 of file graphics.cpp.
|
virtual |
Definition at line 99 of file graphics.cpp.
|
inline |
Definition at line 188 of file graphics.h.
| void Graphics::drawImageRect | ( | const ImageRect & | imgRect, |
| int | x, | ||
| int | y, | ||
| int | w, | ||
| int | h | ||
| ) |
Draws a rectangle using images.
4 corner images, 4 side images and 1 image for the inside.
Definition at line 123 of file graphics.cpp.
|
pure virtual |
Draws a rescaled version of the image.
Implemented in SDLGraphics.
| bool Graphics::drawRescaledImage | ( | const Image * | image, |
| int | x, | ||
| int | y, | ||
| int | width, | ||
| int | height | ||
| ) |
Draws a rescaled version of the image.
Definition at line 52 of file graphics.cpp.
|
virtual |
Draws a rescaled version of the image.
Definition at line 60 of file graphics.cpp.
|
pure virtual |
Draw a pattern based on a rescaled version of the given image.
Implemented in SDLGraphics.
| void Graphics::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.
Definition at line 108 of file graphics.cpp.
| void Graphics::drawText | ( | const std::string & | text, |
| int | x, | ||
| int | y, | ||
| gcn::Graphics::Alignment | align, | ||
| gcn::Font * | font, | ||
| const TextFormat & | format | ||
| ) |
Definition at line 223 of file graphics.cpp.
| void Graphics::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 = {} |
||
| ) |
Definition at line 176 of file graphics.cpp.
|
inlinefinal |
Definition at line 260 of file graphics.h.
|
inline |
Definition at line 248 of file graphics.h.
|
inline |
Returns the logical height of the screen.
Definition at line 226 of file graphics.h.
|
inline |
Returns the graphics scale.
Definition at line 231 of file graphics.h.
|
pure virtual |
Takes a screenshot and returns it as SDL surface.
Implemented in SDLGraphics.
|
inline |
Returns the logical width of the screen.
Definition at line 221 of file graphics.h.
| void Graphics::popClipRect | ( | ) |
Definition at line 263 of file graphics.cpp.
| void Graphics::pushClipRect | ( | const gcn::Rectangle & | rect | ) |
Definition at line 252 of file graphics.cpp.
|
inlineoverride |
Definition at line 255 of file graphics.h.
|
pure virtual |
Sets whether vertical refresh syncing is enabled.
Implemented in SDLGraphics.
|
protectedpure virtual |
Implemented in SDLGraphics.
|
pure virtual |
Updates the screen.
This is done by either copying the buffer to the screen or swapping pages.
Implemented in SDLGraphics.
|
virtual |
Called when the window size or scale has changed.
Reimplemented in SDLGraphics.
Definition at line 30 of file graphics.cpp.
|
pure virtual |
Converts a window coordinate to a logical coordinate.
Used for converting mouse coordinates.
Implemented in SDLGraphics.
|
protected |
Definition at line 277 of file graphics.h.
|
protected |
Definition at line 274 of file graphics.h.
|
protected |
Definition at line 272 of file graphics.h.
|
protected |
Definition at line 273 of file graphics.h.
|
protected |
Definition at line 271 of file graphics.h.