屏幕#
介绍#
The Screen category includes blocks that allow your IQ (2nd gen) Brain’s Screen to display text, values, and graphics on the brain’s built-in screen. These blocks can be used to print sensor data, create custom interfaces, or draw visual elements like lines, shapes, and text with adjustable styles and colors.
Below is a list of all blocks:
Print — Display text and values on the brain.
print — Prints a value or text to the selected screen.
set cursor to row column — Sets the row and column location for printing.
set cursor to next row — Moves the cursor to the next row.
clear row — Clears a specific row.
cursor column — Returns the current cursor column number.
cursor row — Returns the current cursor row number.
Settings — Configure screen display properties.
clear screen — Clears the entire screen.
set font — Sets the font style and size for printed text.
set print precision — Sets how many decimal places to show.
set pen width — Sets the line thickness for drawings.
set pen color — Sets the color used for outlines and text.
set fill color — Sets the fill color for drawn shapes.
Draw — Create shapes and graphics on the brain’s screen.
draw pixel — Draws a single pixel at a coordinate.
draw line — Draws a line between two points.
draw rectangle — Draws a rectangle.
draw circle — Draws a circle.
打印#
打印#
The print block displays text on the brain’s screen at the current cursor position and font.
在屏幕上打印 [VEXcode]▶
参数 |
描述 |
|---|---|
价值 |
要显示的文本、数字或变量值。 |
扩大箭头 |
展开块来读取并将光标设置到下一行,并使光标移动到该块之后的下一行。 |
例子
当开始
[Display a message at the starting cursor position.]
在屏幕上打印 [Hello, Robot!]◀ 并设定光标为下一行

将光标设置到行列#
When using the set cursor to row column block, the cursor is placed at a specific row and column on the brain’s screen. How many rows and columns can comfortably fit depends on the selected font.
等宽字体的字符宽度相同,使文本位置保持一致。相比之下,比例字体的字符宽度各不相同,因此某些字母比其他字母占用更多空间。但是,无论使用哪种类型,将光标设置为行列块都会根据行和列的大小(而不是字体样式)来定位光标。可以使用 设置字体块 调整字体大小。
在屏幕上设定光标至 [1] 行 [1] 列
参数 |
描述 |
|---|---|
排 |
The row of the cursor as an integer. |
柱子 |
The column of the cursor as an integer. |
例子
当开始
[Repeatedly print the current timer at Row 1 Column 1]
永久循环
在屏幕上打印 (计时器秒数)◀ 并设定光标为下一行
等待 (1) 秒
清屏
在屏幕上设定光标至 (1) 行 (1) 列

将光标设置到下一行#
The set cursor to next row block moves the cursor to column 1 on the next row on the brain’s screen.
在屏幕上设定光标至下一行
参数 |
描述 |
|---|---|
This block has no parameters. |
例子
当开始
[Display two lines of text.]
在屏幕上打印 [Line 1]▶
在屏幕上设定光标至下一行
在屏幕上打印 [Line 2]◀ 并设定光标为下一行

清除行#
The clear row block is used to clear a single row on the brain’s screen.
清除屏幕第 (1) 行
参数 |
描述 |
|---|---|
排 |
The row number to clear as an integer. |
例子
当开始
[Display text on two rows, but only keep one.]
在屏幕上打印 [This text stays]◀ 并设定光标为下一行
在屏幕上打印 [This disappears]◀ 并设定光标为下一行
等待 (3) 秒
清除屏幕第 (2) 行
光标列#
光标列块返回将以整数形式打印文本的列号。
(光标列数)
参数 |
描述 |
|---|---|
This block has no parameters. |
例子
当开始
[Display the cursor's current column.]
在屏幕上设定光标至 [3] 行 [2] 列
在屏幕上打印 (光标列数)▶
光标行#
cursor row 块返回将以整数形式打印文本的行号。
(光标行数)
参数 |
描述 |
|---|---|
This block has no parameters. |
例子
当开始
[Display the cursor's current row.]
在屏幕上设定光标至 [3] 行 [2] 列
在屏幕上打印 (光标行数)▶
设置#
清除屏幕#
The clear screen block clears all text and drawings from the brain’s screen.
清屏
参数 |
描述 |
|---|---|
This block has no parameters. |
例子
当开始
[Fill the screen, then clear it after 2 seconds.]
重复 (5)
在屏幕上打印 [Line]◀ 并设定光标为下一行
结束
等待 (3) 秒
清屏
设置字体#
The set font block sets the font and size used for displaying text on the brain’s screen. This font will apply to all subsequently printed text.
设定屏幕字体为 [等宽字体 v] [中 v]
参数 |
描述 |
|---|---|
字体 |
使用的字体:
|
尺寸 |
使用的尺寸:
|
|
|
|
|---|---|---|
|
|
|
|
|
|
|
例子
当开始
[Display two different fonts on separate lines.]
设定屏幕字体为 [等宽字体 v] [中 v]
在屏幕上打印 [Mono Medium]◀ 并设定光标为下一行
设定屏幕字体为 [比例字体 v] [中 v]
在屏幕上打印 [Prop Medium]◀ 并设定光标为下一行

设置打印精度#
The set print precision block sets the precision formatting used for displaying numbers on the brain’s screen. This print precision will apply to all subsequently printed numbers.
在屏幕上设定打印精度为 [0.1 v]
参数 |
描述 |
|---|---|
精确 |
将打印精度设置为:
|
例子
当开始
[Print 1/3 as 0.33.]
在屏幕上设定打印精度为 [0.01 v]
在屏幕上打印 ([1] / [3])◀ 并设定光标为下一行

设置笔宽#
设置笔宽块设置用于绘制线条和形状的笔宽。
设定屏幕笔宽为 [10]
参数 |
描述 |
|---|---|
宽度 |
笔的宽度(以像素为单位),范围从 0 到 32。 |
例子
当开始
[Draw two circles with different pen widths.]
在屏幕 (40) (70) (20) 上画圆形
设定屏幕笔宽为 (5)
在屏幕 (100) (70) (20) 上画圆形

设置笔颜色#
The set pen color block sets the pen color used for drawing lines, shapes, and text on the brain’s screen.
设定屏幕笔/字体颜色为 [红色 v]
参数 |
描述 |
|---|---|
颜色 |
将笔颜色设置为:
|
例子
当开始
[Draw two rectangles with different colors.]
在屏幕 (100) (50) (10) (20) 上画矩形
设定屏幕笔/字体颜色为 [蓝色 v]
在屏幕 (50) (50) (10) (20) 上画矩形

设置填充颜色#
设置填充颜色块设置绘制形状时使用的填充颜色。
设定屏幕填充色为 [红色 v]
参数 |
描述 |
|---|---|
颜色 |
将填充颜色设置为:
|
例子
当开始
[Draw a yellow circle.]
设定屏幕填充色为 [yellow v]
在屏幕 (50) (50) (20) 上画圆形

画#
绘制像素#
绘制像素 块在当前 画笔颜色 中在指定的 (x, y) 屏幕坐标处绘制一个像素。
在屏幕 [0] [0] 上画点
参数 |
描述 |
|---|---|
x |
绘制像素的 x 坐标。 |
y |
绘制像素的 y 坐标。 |
例子
当开始
[Draw one pixel at the center of the screen.]
在屏幕 (80) (50) 上画点
![]()
画线#
画线 块使用当前 笔宽 和 笔颜色 从第一个指定的屏幕坐标 (x1, y1) 到第二个指定的屏幕坐标 (x2, y2) 绘制一条线。
在屏幕 [0] [0] [159] [107] 上画线段
参数 |
描述 |
|---|---|
x1 |
线起点的 x 坐标(以像素为单位)。 |
y1 |
线起点的 y 坐标(以像素为单位)。 |
x2 |
线末端的 x 坐标(以像素为单位)。 |
y2 |
线末端的 y 坐标(以像素为单位)。 |
例子
当开始
[Draw a line from the top left to bottom right of the screen.]
在屏幕 (0) (0) (159) (107) 上画线段

绘制矩形#
绘制矩形块使用当前的 画笔宽度、画笔颜色 和 填充颜色 绘制一个矩形。
在屏幕 [0] [0] [10] [10] 上画矩形
参数 |
描述 |
|---|---|
x |
矩形左上角的 x 坐标(以像素为单位)。 |
y |
矩形左上角的 y 坐标(以像素为单位)。 |
宽度 |
矩形的宽度(以像素为单位)。 |
高度 |
矩形的高度(以像素为单位)。 |
例子
当开始
[Draw a rectangle on the screen.]
在屏幕 (25) (25) (100) (50) 上画矩形

画圆#
画圆 块使用当前的 笔宽、笔颜色 和 填充颜色 绘制一个圆圈。
在屏幕 [0] [0] [10] 上画圆形
参数 |
描述 |
|---|---|
x |
圆心的 x 坐标(以像素为单位)。 |
y |
圆心的 y 坐标(以像素为单位)。 |
半径 |
圆的半径(以像素为单位)。 |
例子
当开始
[Draw a circle on the screen.]
在屏幕 (80) (50) (20) 上画圆形










