Skip to content

Commit

Permalink
Add more documentation to jngl::Sprite
Browse files Browse the repository at this point in the history
  • Loading branch information
jhasse committed Oct 10, 2024
1 parent 241ff4b commit e6afcdd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/jngl/sprite.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class Sprite : public Drawable {
explicit Sprite(const ImageData&, double scale,
std::optional<std::string_view> filename = std::nullopt);

/// 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 uint8_t* bytes, size_t width, size_t height);

/// \deprecated Use Loader instead
Expand Down Expand Up @@ -123,6 +125,9 @@ class Sprite : public Drawable {
void draw(Mat3 modelview, const ShaderProgram* = nullptr) const;
void draw(Mat3 modelview, Alpha, const ShaderProgram* = nullptr) const;

/// Draws the sprite using the specified shader program.
///
/// @param shaderProgram A pointer to the ShaderProgram object to use for drawing.
void draw(const ShaderProgram* shaderProgram) const;

/// While this object is alive, don't do any other draw calls. Should never outlive its Sprite.
Expand Down

0 comments on commit e6afcdd

Please sign in to comment.