mirror of https://github.com/MLXXXp/Arduboy2.git
Merge pull request #46 from Pharap/constexpr-point-and-rect
Make Rect and Point's constructors constexpr
This commit is contained in:
commit
3f9e86ab99
|
@ -8,24 +8,6 @@
|
|||
#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 ==========
|
||||
//========================================
|
||||
|
|
|
@ -122,7 +122,10 @@ struct Rect
|
|||
* \param width The width of the rectangle. Copied to variable `width`.
|
||||
* \param height The height of the rectangle. Copied to variable `height`.
|
||||
*/
|
||||
Rect(int16_t x, int16_t y, uint8_t width, uint8_t height);
|
||||
constexpr Rect(int16_t x, int16_t y, uint8_t width, uint8_t height)
|
||||
: x(x), y(y), width(width), height(height)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//==================================
|
||||
|
@ -153,7 +156,10 @@ struct Point
|
|||
* \param x The X coordinate of the point. Copied to variable `x`.
|
||||
* \param y The Y coordinate of the point. Copied to variable `y`.
|
||||
*/
|
||||
Point(int16_t x, int16_t y);
|
||||
constexpr Point(int16_t x, int16_t y)
|
||||
: x(x), y(y)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
//==================================
|
||||
|
|
Loading…
Reference in New Issue