mirror of https://github.com/MLXXXp/Arduboy2.git
Merge pull request #31 from Pharap/collision-enhancements
Collision enhancements
This commit is contained in:
commit
bd8f73a3c1
|
@ -8,6 +8,24 @@
|
|||
#include "ab_logo.c"
|
||||
#include "glcdfont.c"
|
||||
|
||||
//================================
|
||||
//========== class Rect ==========
|
||||
//================================
|
||||
|
||||
Rect::Rect(int16_t x, int16_t y, uint8_t width, uint8_t height)
|
||||
: x(x), y(y), width(width), height(height)
|
||||
{
|
||||
}
|
||||
|
||||
//=================================
|
||||
//========== class Point ==========
|
||||
//=================================
|
||||
|
||||
Point::Point(int16_t x, int16_t y)
|
||||
: x(x), y(y)
|
||||
{
|
||||
}
|
||||
|
||||
//========================================
|
||||
//========== class Arduboy2Base ==========
|
||||
//========================================
|
||||
|
|
|
@ -104,6 +104,10 @@ struct Rect
|
|||
int16_t y; /**< The Y coordinate of the top left corner */
|
||||
uint8_t width; /**< The width of the rectangle */
|
||||
uint8_t height; /**< The height of the rectangle */
|
||||
|
||||
Rect() = default; /**< The default constructor of the point */
|
||||
|
||||
Rect(int16_t x, int16_t y, uint8_t width, uint8_t height); /**< The fully initialising constructor of the point */
|
||||
};
|
||||
|
||||
/** \brief
|
||||
|
@ -118,6 +122,10 @@ struct Point
|
|||
{
|
||||
int16_t x; /**< The X coordinate of the point */
|
||||
int16_t y; /**< The Y coordinate of the point */
|
||||
|
||||
Point() = default; /**< The default constructor of the point */
|
||||
|
||||
Point(int16_t x, int16_t y); /**< The fully initialising constructor of the point */
|
||||
};
|
||||
|
||||
//==================================
|
||||
|
@ -1019,7 +1027,7 @@ class Arduboy2Base : public Arduboy2Core
|
|||
*
|
||||
* \see Point Rect
|
||||
*/
|
||||
bool collide(Point point, Rect rect);
|
||||
static bool collide(Point point, Rect rect);
|
||||
|
||||
/** \brief
|
||||
* Test if a rectangle is intersecting with another rectangle.
|
||||
|
@ -1036,7 +1044,7 @@ class Arduboy2Base : public Arduboy2Core
|
|||
*
|
||||
* \see Rect
|
||||
*/
|
||||
bool collide(Rect rect1, Rect rect2);
|
||||
static bool collide(Rect rect1, Rect rect2);
|
||||
|
||||
/** \brief
|
||||
* Read the unit ID from system EEPROM.
|
||||
|
|
Loading…
Reference in New Issue