Add complimentary "get" for text "set" functions

Added functions getTextColor(), getTextBackground(),
getTextSize() and getTextWrap() to the Arduboy2 class
This commit is contained in:
Scott Allen 2017-07-31 16:57:28 -04:00
parent 6ab6b83e2c
commit fe30863dbe
3 changed files with 75 additions and 1 deletions

View File

@ -58,6 +58,10 @@ flipHorizontal KEYWORD2
getBuffer KEYWORD2
getCursorX KEYWORD2
getCursorY KEYWORD2
getTextBackground KEYWORD2
getTextColor KEYWORD2
getTextSize KEYWORD2
getTextWrap KEYWORD2
height KEYWORD2
idle KEYWORD2
initRandomSeed KEYWORD2
@ -81,8 +85,8 @@ saveOnOff KEYWORD2
setCursor KEYWORD2
setFrameRate KEYWORD2
setRGBled KEYWORD2
setTextColor KEYWORD2
setTextBackground KEYWORD2
setTextColor KEYWORD2
setTextSize KEYWORD2
setTextWrap KEYWORD2
SPItransfer KEYWORD2

View File

@ -1273,22 +1273,42 @@ void Arduboy2::setTextColor(uint8_t color)
textColor = color;
}
uint8_t Arduboy2::getTextColor()
{
return textColor;
}
void Arduboy2::setTextBackground(uint8_t bg)
{
textBackground = bg;
}
uint8_t Arduboy2::getTextBackground()
{
return textBackground;
}
void Arduboy2::setTextSize(uint8_t s)
{
// size must always be 1 or higher
textSize = max(1, s);
}
uint8_t Arduboy2::getTextSize()
{
return textSize;
}
void Arduboy2::setTextWrap(bool w)
{
textWrap = w;
}
bool Arduboy2::getTextWrap()
{
return textWrap;
}
void Arduboy2::clear()
{
Arduboy2Base::clear();

View File

@ -1295,6 +1295,8 @@ class Arduboy2 : public Print, public Arduboy2Base
* As with all drawing functions, location 0, 0 is the top left corner of
* the display. The cursor location will be the top left corner of the next
* character written.
*
* \see getCursorX() getCursorY()
*/
void setCursor(int16_t x, int16_t y);
@ -1306,6 +1308,8 @@ class Arduboy2 : public Print, public Arduboy2Base
* \details
* The X coordinate returned is a pixel location with 0 indicating the
* leftmost column.
*
* \see getCursorY() setCursor()
*/
int16_t getCursorX();
@ -1317,6 +1321,8 @@ class Arduboy2 : public Print, public Arduboy2Base
* \details
* The Y coordinate returned is a pixel location with 0 indicating the
* topmost row.
*
* \see getCursorX() setCursor()
*/
int16_t getCursorY();
@ -1324,16 +1330,38 @@ class Arduboy2 : public Print, public Arduboy2Base
* Set the text foreground color.
*
* \param color The color to be used for following text.
*
* \see setTextBackground() getTextColor()
*/
void setTextColor(uint8_t color);
/** \brief
* Get the currently set text foreground color.
*
* \return The color that will be used to display any following text.
*
* \see setTextColor()
*/
uint8_t getTextColor();
/** \brief
* Set the text background color.
*
* \param bg The background color to be used for following text.
*
* \see setTextColor() getTextBackground()
*/
void setTextBackground(uint8_t bg);
/** \brief
* Get the currently set text background color.
*
* \return The background color that will be used to display any following text.
*
* \see setTextBackground()
*/
uint8_t getTextBackground();
/** \brief
* Set the text character size.
*
@ -1347,9 +1375,20 @@ class Arduboy2 : public Print, public Arduboy2Base
* The value specified is a multiplier. A value of 2 will double the
* size so they will occupy 12x16 pixels. A value of 3 will result in
* 18x24, etc.
*
* \see getTextSize()
*/
void setTextSize(uint8_t s);
/** \brief
* Get the currently set text size.
*
* \return The size that will be used for any following text.
*
* \see setTextSize()
*/
uint8_t getTextSize();
/** \brief
* Set or disable text wrap mode.
*
@ -1364,9 +1403,20 @@ class Arduboy2 : public Print, public Arduboy2Base
* If wrap mode is disabled, characters will continue to be written to the
* same line. A character at the right edge of the screen may only be
* partially displayed and additional characters will be off screen.
*
* \see getTextWrap()
*/
void setTextWrap(bool w);
/** \brief
* Get the currently set text wrap mode.
*
* \return `true` if text wrapping is on, `false` if wrapping is off.
*
* \see setTextWrap()
*/
bool getTextWrap();
/** \brief
* Clear the display buffer and set the text cursor to location 0, 0
*/