|
| | Sprite (const ImageData &, double scale, std::optional< std::string_view > filename=std::nullopt) |
| | Creates a Sprite from ImageData and scales it by scale.
|
| |
|
| Sprite (const uint8_t *bytes, size_t width, size_t height) |
| | The sprite data is stored as packed RGBA bytes in an array, where the size of the array needs to be calculated as width * height * 4.
|
| |
| | Sprite (const std::string &filename, LoadType loadType=LoadType::NORMAL) |
| |
| void | step () override |
| | Does nothing.
|
| |
| void | draw () const override |
| | Draws the Sprite, centered by default.
|
| |
| void | draw (Mat3 modelview, const ShaderProgram *shaderProgram=nullptr) const |
| | Draws the image centered using modelview.
|
| |
|
void | draw (Mat3 modelview, Alpha, const ShaderProgram *shaderProgram=nullptr) const |
| |
| void | draw (Mat3 modelview, Rgba color) const |
| | Draws the sprite but multiplies each pixel's color with color.
|
| |
| void | draw (const ShaderProgram *shaderProgram) const |
| | Draws the sprite using the specified shader program.
|
| |
| Batch | batch (const ShaderProgram *shaderProgram=nullptr) const |
| | Allows to draw the Sprite multiple times at different locations in an efficient way.
|
| |
| void | drawScaled (float xfactor, float yfactor, const ShaderProgram *shaderProgram=nullptr) const |
| | Draws the image scaled by xfactor and yfactor
|
| |
| void | drawClipped (float xstart, float xend, float ystart, float yend) const |
| |
|
void | drawClipped (Vec2 start, Vec2 end) const |
| | Draw a cutout of the sprite. drawClipped({0, 0}, {1, 1}) would draw it normally.
|
| |
|
void | drawMesh (const std::vector< Vertex > &vertexes, const ShaderProgram *=nullptr) const |
| | Draws a list of triangles with the sprite's texture on it using the global modelview from jngl::modelview()
|
| |
| void | drawMesh (const Mat3 &modelview, const std::vector< Vertex > &vertexes, const ShaderProgram *shaderProgram=nullptr) const |
| | Draws a list of triangles with the sprite's texture on it, ignores the Sprite's position.
|
| |
|
void | drawMesh (Mat3 modelview, const std::vector< Vertex > &vertexes, jngl::Rgba color, const ShaderProgram *=nullptr) const |
| |
|
void | setBytes (const unsigned char *) |
| |
|
| Drawable (const Drawable &)=default |
| |
|
Drawable & | operator= (const Drawable &)=default |
| |
|
| Drawable (Drawable &&)=default |
| |
|
Drawable & | operator= (Drawable &&)=default |
| |
|
Vec2 | getPos () const |
| | Returns position (not center)
|
| |
|
virtual void | setPos (double x, double y) |
| | Sets the position of the top-left of the Drawable.
|
| |
| template<class Vect > |
| void | setPos (Vect p) |
| | Sets the position of the top-left of the Drawable.
|
| |
|
jngl::Vec2 | getCenter () const |
| | Returns the position of the center of the Drawable.
|
| |
|
virtual void | setCenter (double x, double y) |
| | Centers the Sprite at (x, y)
|
| |
| template<class Vect > |
| void | setCenter (Vect c) |
| | Centers the Sprite at c (e.g. jngl::Vec2)
|
| |
|
double | getLeft () const |
| | Returns the distance from the left side of the screen.
|
| |
|
void | setLeft (double x) |
| |
|
double | getTop () const |
| | Returns the distance from the top of the screen.
|
| |
|
void | setTop (double y) |
| |
|
double | getRight () const |
| | Returns the distance from the right side of the screen.
|
| |
|
void | setRight (double x) |
| |
|
double | getBottom () const |
| | Returns the distance from the bottom of the screen.
|
| |
|
void | setBottom (double y) |
| |
|
double | getX () const |
| |
|
void | setX (double) |
| |
|
double | getY () const |
| |
|
void | setY (double) |
| |
|
Vec2 | getSize () const |
| | Returns {width, height} in screen coordinates.
|
| |
|
float | getWidth () const |
| | Returns the width in screen coordinates.
|
| |
|
float | getHeight () const |
| | Returns the height in screen coordinates.
|
| |
|
void | drawBoundingBox () const |
| | Draws a red box around the Drawable.
|
| |
|
bool | contains (jngl::Vec2 point) const |
| | Returns whether point is inside the bounding box.
|
| |
Higher-level representation of an image.
Definition at line 26 of file Sprite.hpp.