Verified Commit 69dc710c authored by RobLoach's avatar RobLoach
Browse files

Update graphics.draw()

parent de898d7a
......@@ -4,6 +4,15 @@ All notable changes to [ChaiLove](https://github.com/RobLoach/ChaiLove) will be
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
## 0.16.0 - 2018-03-05
### Fixed
- Fix undefined zlib symbols in debug build
- By [@fetzerch](https://github.com/fetzerch) in [#200](https://github.com/libretro/libretro-chailove/pull/200)
### Changed
- Added `love.graphics.draw(Image)` and `love.graphics.draw(Image, Quad)` with default position of 0,0
- Update documentation
## 0.15.1 - 2017-03-05
### Changed
- Update dependencies
......
......@@ -95,6 +95,10 @@ graphics& graphics::line(int x1, int y1, int x2, int y2) {
return *this;
}
graphics& graphics::draw(Image* image) {
return draw(image);
}
graphics& graphics::draw(Image* image, int x, int y) {
if (image && image->loaded()) {
SDL_Rect dstrect;
......@@ -106,6 +110,10 @@ graphics& graphics::draw(Image* image, int x, int y) {
return *this;
}
graphics& graphics::draw(Image* image, Quad quad) {
return draw(image, quad, 0, 0);
}
graphics& graphics::draw(Image* image, Quad quad, int x, int y) {
if (image && image->loaded()) {
SDL_Rect dest;
......
......@@ -72,23 +72,13 @@ class graphics {
/**
* @brief Draws a line.
*/
graphics& line(int x1, int y1, int x2, int y2);
/**
* @brief Draws an image on screen.
*
* @param image The image to draw on the screen.
* @param x The position to draw the object (x-axis).
* @param y The position to draw the object (y-axis).
*/
graphics& draw(Image* image, int x, int y);
/**
* @brief Draws an image on screen, using the given Quad as a source.
* @param x1 The position of first point on the x-axis.
* @param y1 The position of first point on the y-axis.
* @param x2 The position of second point on the x-axis.
* @param y2 The position of second point on the y-axis.
*/
graphics& draw(Image* image, Quad quad, int x, int y);
graphics& line(int x1, int y1, int x2, int y2);
/**
* @brief Creates a new Quad.
......@@ -246,6 +236,19 @@ class graphics {
graphics& draw(Image* image, int x, int y, float r, float sx, float sy);
graphics& draw(Image* image, int x, int y, float r, float sx);
graphics& draw(Image* image, int x, int y, float r);
graphics& draw(Image* image, int x, int y);
graphics& draw(Image* image);
/**
* @brief Draws an image on screen, using the given Quad as a source.
*
* @param image The image to draw on the screen.
* @param quad The source quad of the image.
* @param x (0) The position to draw the object (x-axis).
* @param y (0) The position to draw the object (y-axis).
*/
graphics& draw(Image* image, Quad quad, int x, int y);
graphics& draw(Image* image, Quad quad);
/**
* @brief Draws an arc.
......
......@@ -196,6 +196,7 @@ script::script(const std::string& file) {
chai.add(fun<love::graphics&, graphics, int, int, int>(&graphics::setBackgroundColor), "setBackgroundColor");
chai.add(fun<love::graphics&, graphics, Image*, int, int>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*, int, int, float, float, float, float, float>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*, int, int, float, float, float, float>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*, int, int, float, float, float>(&graphics::draw), "draw");
......@@ -203,6 +204,8 @@ script::script(const std::string& file) {
chai.add(fun<love::graphics&, graphics, Image*, int, int, float>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*, Quad, int, int>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, Image*, Quad>(&graphics::draw), "draw");
chai.add(fun<love::graphics&, graphics, int, int, int, int>(&graphics::clear), "clear");
chai.add(fun<love::graphics&, graphics, int, int, int>(&graphics::clear), "clear");
chai.add(fun<love::graphics&, graphics>(&graphics::clear), "clear");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment