VEX V5 C++ API
|
Use this class to write or draw to the brain's LCD screen. More...
Public Member Functions | |
lcd () | |
~lcd () | |
void | setCursor (int32_t row, int32_t col) |
Sets the cursor to the row and column number set in the parameters. More... | |
void | setFont (fontType font) |
Sets the font type to be displayed on the Screen that is determined by the parameter. More... | |
void | setPenWidth (uint32_t width) |
Sets the pen's width. More... | |
void | setOrigin (int32_t x, int32_t y) |
Sets the origin of the screen to the parameters defined in the function. More... | |
int32_t | column () |
An integer that tracks the current cursor position's column, starting at 1. More... | |
int32_t | row () |
An integer that tracks the current cursor position's row, starting at 1. More... | |
template<class T > | |
void | setPenColor (T color) |
void | setPenColor (const color &color) |
Sets the color of the pen to a specified color. More... | |
void | setPenColor (const char *color) |
Sets the color of the pen to a specified color using a hex value. More... | |
void | setPenColor (int hue) |
Sets the color of the pen to a specified color. More... | |
template<class T > | |
void | setFillColor (T color) |
void | setFillColor (const color &color) |
Sets the default fill color for any subsequent draw command. More... | |
void | setFillColor (const char *color) |
Sets the default fill color for any subsequent draw command. More... | |
void | setFillColor (int hue) |
Sets the default fill color for any subsequent draw command. More... | |
int32_t | getStringWidth (const char *cstr) |
Gets the width in pixels of the given string. More... | |
int32_t | getStringHeight (const char *cstr) |
Gets the height in pixels of the given string. More... | |
template<class T > | |
void | print (T value) |
Prints a number, string, or boolean. More... | |
void | print (const char *format,...) |
void | print (char *format,...) |
void | printLine (int32_t number, const char *format,...) |
Prints a number, string, or boolean at a particular line, clearing the rest of the line. More... | |
void | printAt (int32_t x, int32_t y, const char *format,...) |
Prints a number, string, or boolean at an x, y pixel location. More... | |
void | printAt (int32_t x, int32_t y, bool bOpaque, const char *format,...) |
Prints a number, string, or boolean at an x, y pixel location with the ability to be transparent. More... | |
template<class T > | |
void | clearScreen (T color) |
void | clearScreen (void) |
Clears the whole Screen to a default color or otherwise specified color. More... | |
void | clearScreen (const color &color) |
Clears the whole Screen to a default color or otherwise specified color. More... | |
void | clearScreen (const char *color) |
Clears the whole Screen to a default color or otherwise specified color. More... | |
void | clearScreen (int hue) |
Clears the whole Screen to a default color or otherwise specified color. More... | |
template<class T1 , class C > | |
void | clearLine (T1 number, C color) |
void | clearLine (int number, const color &color) |
Clears the specified line and sets it to a specified color. More... | |
void | clearLine (int number, const char *color) |
Clears the specified line and sets it to a specified color. More... | |
void | clearLine (int number, int hue) |
Clears the specified line and sets it to a specified color. More... | |
void | clearLine (void) |
Clears the rest of the line from where the cursor is located. More... | |
void | newLine (void) |
void | drawPixel (int x, int y) |
Draws a single pixel to the screen in the specified x and y location. More... | |
void | drawLine (int x1, int y1, int x2, int y2) |
Draws a line connecting the two specified points in the parameters. More... | |
template<class T1 , class T2 , class T3 , class T4 , class C > | |
void | drawRectangle (T1 x, T2 y, T3 width, T4 height, C color) |
void | drawRectangle (int x, int y, int width, int height) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the current pen and fill color. More... | |
void | drawRectangle (int x, int y, int width, int height, const color &color) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified. More... | |
void | drawRectangle (int x, int y, int width, int height, const char *color) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified. More... | |
void | drawRectangle (int x, int y, int width, int height, int hue) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified. More... | |
template<class T1 , class T2 , class T3 , class C > | |
void | drawCircle (T1 x, T2 y, T3 radius, C color) |
void | drawCircle (int x, int y, int radius) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the current pen and fill color. More... | |
void | drawCircle (int x, int y, int radius, const color &color) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified. More... | |
void | drawCircle (int x, int y, int radius, const char *color) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified. More... | |
void | drawCircle (int x, int y, int radius, int hue) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified. More... | |
void | drawBitmap (const bitmap &image, int x=0, int y=0) |
Draws a bitmap image on the screen. More... | |
void | drawEyes (EyesIdT eyesId) |
Draws eye graphics on the screen. More... | |
int32_t | xPosition () |
Gets the last x location pressed on the screen. More... | |
int32_t | yPosition () |
Gets the last y location pressed on the screen. More... | |
bool | pressing () |
Gets the pressed status of the Screen. More... | |
bool | render () |
Switches to double buffering or renders back buffer to screen. More... | |
bool | render (bool bVsyncWait, bool bRunScheduler=true) |
Switches to double buffering or renders back buffer to screen. More... | |
bool | drawImageFromBuffer (uint8_t *buffer, int x, int y, int bufferLen) |
Draws an image on the screen using the contents of the memory buffer. More... | |
bool | drawImageFromBuffer (uint32_t *buffer, int x, int y, int width, int height) |
Draws an image on the screen using the contents of the memory buffer. More... | |
bool | drawImageFromFile (const char *name, int x, int y) |
Draws an image on the screen using a file on the SD Card as the source. More... | |
Use this class to write or draw to the brain's LCD screen.
The LCD screen has a resolution of 480x240 pixels
vex::brain::lcd::lcd | ( | ) |
|
inline |
void vex::brain::lcd::setCursor | ( | int32_t | row, |
int32_t | col | ||
) |
Sets the cursor to the row and column number set in the parameters.
row | Sets the row number for where the cursor is placed. 1 is the top row. |
col | Sets the column number for where the cursor is placed. 1 is the left column. |
void vex::brain::lcd::setFont | ( | fontType | font | ) |
Sets the font type to be displayed on the Screen that is determined by the parameter.
font | The type of font that is displayed. |
void vex::brain::lcd::setPenWidth | ( | uint32_t | width | ) |
Sets the pen's width.
width | This represents the width of the pen when drawing. A larger width equals a wider pen stroke. |
void vex::brain::lcd::setOrigin | ( | int32_t | x, |
int32_t | y | ||
) |
Sets the origin of the screen to the parameters defined in the function.
x | The x location of the origin. |
y | The y location of the origin. |
int32_t vex::brain::lcd::column | ( | ) |
An integer that tracks the current cursor position's column, starting at 1.
int32_t vex::brain::lcd::row | ( | ) |
An integer that tracks the current cursor position's row, starting at 1.
|
inline |
void vex::brain::lcd::setPenColor | ( | const color & | color | ) |
Sets the color of the pen to a specified color.
color | A color unit where colors can be defined as names. |
void vex::brain::lcd::setPenColor | ( | const char * | color | ) |
Sets the color of the pen to a specified color using a hex value.
color | A hexadecimal value that represents color. |
void vex::brain::lcd::setPenColor | ( | int | hue | ) |
Sets the color of the pen to a specified color.
hue | The integer represents the hue of the color. |
|
inline |
void vex::brain::lcd::setFillColor | ( | const color & | color | ) |
Sets the default fill color for any subsequent draw command.
color | In a color unit, colors can be defined as names. |
void vex::brain::lcd::setFillColor | ( | const char * | color | ) |
Sets the default fill color for any subsequent draw command.
color | A hexadecimal value that represents color. |
void vex::brain::lcd::setFillColor | ( | int | hue | ) |
Sets the default fill color for any subsequent draw command.
hue | The integer represents the hue of the color. |
int32_t vex::brain::lcd::getStringWidth | ( | const char * | cstr | ) |
Gets the width in pixels of the given string.
int32_t vex::brain::lcd::getStringHeight | ( | const char * | cstr | ) |
Gets the height in pixels of the given string.
|
inline |
Prints a number, string, or boolean.
value | Information to display on the screen. |
void vex::brain::lcd::print | ( | const char * | format, |
... | |||
) |
format | This is a reference to a char format that prints the value of variables. |
... | A variable list of parameters to insert into format string. |
void vex::brain::lcd::print | ( | char * | format, |
... | |||
) |
void vex::brain::lcd::printLine | ( | int32_t | number, |
const char * | format, | ||
... | |||
) |
Prints a number, string, or boolean at a particular line, clearing the rest of the line.
number | Line to print on, 1 is top line. |
format | This is a reference to a char format that prints the value of variables. |
... | A variable list of parameters to insert into format string. |
void vex::brain::lcd::printAt | ( | int32_t | x, |
int32_t | y, | ||
const char * | format, | ||
... | |||
) |
Prints a number, string, or boolean at an x, y pixel location.
x | The x-coordinate at which to print a message on the screen. |
y | The y-coordinate at which to print the baseline of the message on the screen. |
format | A reference to a char format to print the value of variables. |
... | A variable list of parameters to insert into format string. |
void vex::brain::lcd::printAt | ( | int32_t | x, |
int32_t | y, | ||
bool | bOpaque, | ||
const char * | format, | ||
... | |||
) |
Prints a number, string, or boolean at an x, y pixel location with the ability to be transparent.
x | The x-coordinate at which to print a message on the screen. |
y | The y-coordinate at which to print the baseline of the message on the screen. |
bOpaque | If set to false, the print will be transparent. |
format | A reference to a char format to print the value of variables. |
... | A variable list of parameters to insert into format string. |
|
inline |
void vex::brain::lcd::clearScreen | ( | void | ) |
Clears the whole Screen to a default color or otherwise specified color.
void vex::brain::lcd::clearScreen | ( | const color & | color | ) |
Clears the whole Screen to a default color or otherwise specified color.
color | In a color unit, colors can be defined as names. |
void vex::brain::lcd::clearScreen | ( | const char * | color | ) |
Clears the whole Screen to a default color or otherwise specified color.
color | A hexadecimal value that represents color. |
void vex::brain::lcd::clearScreen | ( | int | hue | ) |
Clears the whole Screen to a default color or otherwise specified color.
hue | The integer represents the hue of the color. |
|
inline |
void vex::brain::lcd::clearLine | ( | int | number, |
const color & | color | ||
) |
Clears the specified line and sets it to a specified color.
number | The integer sets the line that is to be cleared. |
color | A color unit where colors can be defined as names. |
void vex::brain::lcd::clearLine | ( | int | number, |
const char * | color | ||
) |
Clears the specified line and sets it to a specified color.
number | The integer sets the line that is to be cleared. |
color | A hexadecimal value that represents color. |
void vex::brain::lcd::clearLine | ( | int | number, |
int | hue | ||
) |
Clears the specified line and sets it to a specified color.
number | The integer sets the line that is to be cleared. |
hue | An integer that represents the hue of the color. |
void vex::brain::lcd::clearLine | ( | void | ) |
Clears the rest of the line from where the cursor is located.
void vex::brain::lcd::newLine | ( | void | ) |
void vex::brain::lcd::drawPixel | ( | int | x, |
int | y | ||
) |
Draws a single pixel to the screen in the specified x and y location.
x | The x location of where to draw the pixel. |
y | The y location of where to draw the pixel. |
void vex::brain::lcd::drawLine | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
Draws a line connecting the two specified points in the parameters.
x1 | The x location of the first point. |
y1 | The y location of the first point. |
x2 | The x location of the second point. |
y2 | The y location of the second point. |
|
inline |
void vex::brain::lcd::drawRectangle | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the current pen and fill color.
x | The x-coordinate at which the left edge of the rectangle will be drawn on the screen. |
y | The y-coordinate at which the top edge of the rectangle will be drawn on the screen. |
width | The width of the rectangle. |
height | The height of the rectangle. |
void vex::brain::lcd::drawRectangle | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
const color & | color | ||
) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified.
x | The x-coordinate at which the left edge of the rectangle will be drawn on the screen. |
y | The y-coordinate at which the top edge of the rectangle will be drawn on the screen. |
width | The width of the rectangle. |
height | The height of the rectangle. |
color | A color unit where colors can be defined as names. |
void vex::brain::lcd::drawRectangle | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
const char * | color | ||
) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified.
x | The x-coordinate at which the left edge of the rectangle will be drawn on the screen. |
y | The y-coordinate at which the top edge of the rectangle will be drawn on the screen. |
width | The width of the rectangle. |
height | The height of the rectangle. |
color | A hexadecimal value that represents color. |
void vex::brain::lcd::drawRectangle | ( | int | x, |
int | y, | ||
int | width, | ||
int | height, | ||
int | hue | ||
) |
Draws a rectangle using the specified points and attributes set in the parameters. Fills the rectangle with the color specified.
x | The x-coordinate at which the left edge of the rectangle will be drawn on the screen. |
y | The y-coordinate at which the top edge of the rectangle will be drawn on the screen. |
width | The width of the rectangle. |
height | The height of the rectangle. |
hue | The color of the rectangle. |
|
inline |
void vex::brain::lcd::drawCircle | ( | int | x, |
int | y, | ||
int | radius | ||
) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the current pen and fill color.
x | The central x location of the circle. |
y | The central y location of the circle. |
radius | Sets the radius of the circle to be drawn on the Screen. |
void vex::brain::lcd::drawCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const color & | color | ||
) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified.
x | The central x location of the circle. |
y | The central y location of the circle. |
radius | Sets the radius of the circle to be drawn on the Screen. |
color | A color unit where colors can be defined as names. |
void vex::brain::lcd::drawCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
const char * | color | ||
) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified.
x | The central x location of the circle. |
y | The central y location of the circle. |
radius | Sets the radius of the circle to be drawn on the Screen. |
color | A hexadecimal value that represents color. |
void vex::brain::lcd::drawCircle | ( | int | x, |
int | y, | ||
int | radius, | ||
int | hue | ||
) |
Draws a circle using the specified points and attributes set in the parameters. Fills the circle with the color specified.
x | The central x location of the circle. |
y | The central y location of the circle. |
radius | Sets the radius of the circle to be drawn on the Screen. |
hue | An integer that represents the hue of the color. |
void vex::brain::lcd::drawBitmap | ( | const bitmap & | image, |
int | x = 0 , |
||
int | y = 0 |
||
) |
Draws a bitmap image on the screen.
image | The bitmap image to draw |
x | The left-coordinate of the bitmap (default 0) |
y | The top-coordinate of the bitmap (default 0) |
void vex::brain::lcd::drawEyes | ( | EyesIdT | eyesId | ) |
Draws eye graphics on the screen.
eyesId | EYES_* eyes id value |
int32_t vex::brain::lcd::xPosition | ( | ) |
Gets the last x location pressed on the screen.
int32_t vex::brain::lcd::yPosition | ( | ) |
Gets the last y location pressed on the screen.
bool vex::brain::lcd::pressing | ( | ) |
Gets the pressed status of the Screen.
bool vex::brain::lcd::render | ( | ) |
Switches to double buffering or renders back buffer to screen.
bool vex::brain::lcd::render | ( | bool | bVsyncWait, |
bool | bRunScheduler = true |
||
) |
Switches to double buffering or renders back buffer to screen.
bVsyncWait | If true, wait for the Vsync signal to render. |
bRunScheduler | (Optional) If true, run background tasks while waiting to render. By default, this parameter is true. |
bool vex::brain::lcd::drawImageFromBuffer | ( | uint8_t * | buffer, |
int | x, | ||
int | y, | ||
int | bufferLen | ||
) |
Draws an image on the screen using the contents of the memory buffer.
buffer | A pointer to a buffer containing image data in either bmp or png format. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
bufferLen | The size of the source image buffer in bytes. |
This function draws an image on the screen using the contents of a buffer into which either BMP or PNG raw data has already been read. The contents may have come from a file on the SD card or have been statically declared in the code. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.
bool vex::brain::lcd::drawImageFromBuffer | ( | uint32_t * | buffer, |
int | x, | ||
int | y, | ||
int | width, | ||
int | height | ||
) |
Draws an image on the screen using the contents of the memory buffer.
buffer | A pointer to a buffer containing raw 32 bit per pixel image data. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
width | The width of the image. |
height | The height of the image. |
This funtion draws an image on the screen using the contents of a buffer into which raw RGB pixels have been placed. Each pixel is represented by a 32 bit value, however, only the lower 24 bits are used as transparency is not yet supported. The buffer contains pixels for the first row of the image immediately followed by pixels for the second row and so on. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.
bool vex::brain::lcd::drawImageFromFile | ( | const char * | name, |
int | x, | ||
int | y | ||
) |
Draws an image on the screen using a file on the SD Card as the source.
name | The name of the image, it must have either a ".bmp" or ".png" extension. |
x | The x-coordinate at which the left edge of the image will be drawn. |
y | The y-coordinate at which the top edge of the image will be drawn. |
This funtion draws an image on the screen using the contents of a file on an SD Card. The file should be no larger than 512K bytes and must have either a ".bmp" or ".png" extension. The image should be no larger than the V5 Screen, that is, a maximum of 480 pixels wide by 272 pixels high. The top/left corner of the image is placed at the coordinates given by x and y, these can be negative if desired.