Screen#
Introduction#
The VEX AIR Controller’s screen provides blocks for displaying text, managing the cursor, drawing shapes, and handling touch interactions.
Below is a list of all available blocks, grouped by functionality:
Cursor Print - Manage text display using a row-and-column cursor system.
print – Displays text on the screen at the current cursor position.
set cursor to row column – Moves the cursor to a specific row and column.
set cursor to next row – Moves the cursor to column 1 of the next row.
clear row – Clears a specified row of text.
screen cursor column – Returns the column number where text will be printed.
screen cursor row – Returns the row number where text will be printed.
XY Print - Print text at pixel-based coordinates.
print at – Displays text at a specified x and y coordinate.
set screen origin – Changes the origin (0, 0) used for drawing and printing.
Settings - Customize text formatting and screen display.
clear screen – Erases all text and drawings from the screen.
wait for screen to render – Wait for drawing and print commands to render on the screen.
fill screen – Erases all text and drawings from the screen, then sets the screen’s background color.
set font – Changes the font type and size for text display.
set print precision – Adjusts the amount of decimal places for printed numbers.
set pen width – Adjusts the thickness of drawn lines.
set pen / font color – Changes the color for text and drawings.
set fill color – Defines the fill color for shapes.
Draw - Create graphics and visual elements.
show image file – Displays a user-uploaded image on the screen.
draw pixel – Draws a single pixel at a specified coordinate.
draw line – Draws a line between two points.
draw rectangle – Draws a rectangle with specified dimensions.
draw circle – Draws a circle with a given radius.
Touch - Detect screen interactions.
screen pressed? – Returns whether the screen is currently being pressed.
screen position – Retrieves the x and y coordinates where the screen was last touched.
when screen event – Triggers when the screen is pressed or released.
Cursor Print#
print#
The print block displays text on the controller’s print area at the current cursor position and font.
print [VEXcode] on screen ▶
Parameters |
Description |
---|---|
value |
The text, number, or variable value to display on the screen. |
expanding arrow |
Expand the block to read and set cursor to next row and make the cursor move to the next row after this block. |
Example
Example coming soon!
set cursor to row column#
When using the set cursor to row column block, the cursor is placed at a specific row and column on the print area. How many rows and columns can comfortably fit depends on the selected font. With the default monospaced medium font, up to 11 rows and 53 columns can be displayed clearly. Text placed beyond this range may be cut off or become difficult to read.
Monospaced fonts have characters that are all the same width, making text placement consistent. In contrast, proportional fonts vary in character width, so some letters take up more space than others. However, regardless of which type is used, the set cursor to row column block positions the cursor based on row and column size, not font style. The font size can be adjusted using the set font block.
set cursor to row [1] column [1] on screen
Parameters |
Description |
---|---|
row |
The row of the cursor. |
column |
The column of the cursor. |
Examples
Example coming soon!
set cursor to next row#
The set cursor to next row block moves the cursor to column 1 on the next row on the controller’s print area.
set cursor to next row on screen
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
clear row#
The clear row block clears a row of text on the controller’s print area.
clear row [1] on screen
Parameters |
Description |
---|---|
row |
The row number to clear. |
Example
Example coming soon!
screen cursor column#
The screen cursor column returns the value of the column where text will be printed as an integer.
(screen cursor column)
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
screen cursor row#
The screen cursor row block returns the value of the row where text will be printed as an integer.
(screen cursor row)
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
XY Print#
print at#
The print at block displays text on the robot’s screen at a specific (x, y) position in pixels, using the currently set font. x
sets how far from the left side the text begins, and y
sets where the bottom of the letters sit. This method disregards the current cursor position.
print [VEXcode] at x:[80] y:[120] on screen
Parameters |
Description |
---|---|
value |
The text, number, or variable value to display on the screen. |
x |
The x-coordinate in pixels (0 to 640, where 0 is left and 640 is right). |
y |
The y-coordinate in pixels (0 to 480, where 0 is top and 480 is bottom). |
Example
Example coming soon!
set screen origin#
The set screen origin sets the origin (0, 0) used for drawing or printing on the controller’s print area. By default, drawing or printing blocks consider the top left corner of the screen as the origin. This block can reset the origin to an alternate (x, y) screen coordinate location.
set screen origin x: [0] y: [0]
Parameters |
Description |
---|---|
x |
The x-coordinate in pixels to set the new origin to. |
y |
The y-coordinate in pixels to set the new origin to. |
Example
Example coming soon!
Settings#
clear screen#
The clear screen block clears the controller’s print area of all drawings and text.
clear screen
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
wait for screen to render#
The wait for screen to render block prevents any following blocks from running until all previous drawing and print commands on the screen have finished rendering.
wait for screen to render
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
fill screen#
The fill screen block clears the controller’s print area of all drawings and text, then changes the background to a specified color.
fill screen with [red v]
Parameters |
Description |
---|---|
color |
The color to change the background to:
|
Example
Example coming soon!
set font#
The set font block sets the font and size used for displaying text on the controller’s print area. This font will apply to all subsequently printed text.
set font to [monospaced v] [super small v] on screen
Parameters |
Description |
---|---|
type |
The font type:
|
size |
The font size (shown below):
|
|
|
|
---|---|---|
|
|
|
|
|
|
|
|
|
Example
Example coming soon!
set print precision#
The set print precision block sets the precision formatting used for displaying numbers on the controller’s print area. This print precision will apply to all subsequently printed numbers.
Documentation Coming Soon
set pen width#
The set pen width block sets the pen width used for drawing lines and shapes.
set pen width to [10] on screen
Parameters |
Description |
---|---|
width |
The pen width in pixels. |
Example
Example coming soon!
set pen / font color#
The set pen / font color block sets the pen color used for drawing lines, shapes, and text on the controller’s print area.
set pen / font color to [red v] on screen
Example
Parameters |
Description |
---|---|
color |
Sets the pen color to:
|
Example coming soon!
set fill color#
The set fill color block sets the fill color used when shapes are drawn.
set fill color to [red v] on screen
Parameters |
Description |
---|---|
color |
Sets the fill color to:
|
Examples
Example coming soon!
Draw#
show image file#
The show image file block draws a custom user-uploaded image on the controller’s print area.
show image file [1 v]
Parameters |
Description |
---|---|
image slot number |
The custom image to use, number 1 to 10. The image number aligns with the number shown in the AIR control panel. |
Example
Example coming soon!
draw pixel#
The draw pixel block draws a pixel at the specified (x, y) screen coordinate in the current pen color.
draw pixel [0] [0] on screen
Parameters |
Description |
---|---|
x |
The x-coordinate to draw the pixel, ranging from 0 to 640. |
y |
The y-coordinate to draw the pixel, ranging from 0 to 480. |
Example
Example coming soon!
draw line#
The draw line block draws a line from the first specified screen coordinate (x1, y1) to the second specified screen coordinate (x2, y2) using the current pen width and pen color.
draw line [0] [0] [10] [10] on screen
Parameters |
Description |
---|---|
x1 |
The x-coordinate in pixels of the start of the line, ranging from 0 to 640. |
y1 |
The y-coordinate in pixels of the start of the line, ranging from 0 to 480. |
x2 |
The x-coordinate in pixels of the end of the line, ranging from 0 to 640. |
y2 |
The y-coordinate in pixels of the end of the line, ranging from 0 to 480. |
Example
Example coming soon!
draw rectangle#
The draw rectangle block draws a rectangle using the current pen width, pen color, and fill colors.
draw rectangle [0] [0] [10] [10] on screen
Example
Parameters |
Description |
---|---|
x |
The x-coordinate in pixels of the top-left corner of the rectangle, ranging from 0 to 640. |
y |
The y-coordinate in pixels of the top-left corner of the rectangle, ranging from 0 to 480. |
width |
The width of the rectangle in pixels, ranging from 0 to 640. |
height |
The height of the rectangle in pixels, ranging from 0 to 480. |
Example coming soon!
draw circle#
The draw circle block draws a circle using the current pen width, pen color, and fill colors.
draw circle [0] [0] [10] on screen
Parameters |
Description |
---|---|
x |
The x-coordinate in pixels of the center of the circle, ranging from 0 to 640. |
y |
The y-coordinate in pixels of the center of the circle, ranging from 0 to 480. |
radius |
The radius of the circle in pixels, ranging from 0 to 480. |
Example
Example coming soon!
Touch#
screen pressed?#
The screen pressed? block reports if the controller’s screen is currently being pressed or not pressed. This block returns a Boolean value:
True - Screen is currently being pressed
False - Screen is not being pressed
<screen pressed?>
Parameters |
Description |
---|---|
This block has no parameters. |
Example
Example coming soon!
screen position#
The screen position block returns an integer showing the x- and y-coordinate (in pixels) where the screen was pressed. The return value for x is between 0 (left) and 640 (right). The return value for y is between 0 (top) and 480 (bottom).
(screen [x v] position)
Parameters |
Description |
---|---|
coordinate |
The coordinate of the last screen press in pixels:
|
Example
Example coming soon!
when screen event#
The when screen event block is to be called when the controller’s screen is pressed or is no longer being pressed.
when screen [pressed v] :: hat events
Parameters |
Description |
---|---|
action |
Determines when the attached stack of blocks will execute:
|
Example
Example coming soon!