屏幕#
介绍#
屏幕模块控制 V5 大脑的触摸屏,使你的机器人能够显示文本、数字和图形,并响应触摸输入。
默认情况下,打印到大脑的字体是等宽小号,它有 12 行 48 列。
For drawing, the Brain’s resolution is 480 x 240 pixels.
V5 大脑屏幕,红色网格线显示了总共 12 行 48 列的布局。像素尺寸为 479 宽 x 239 高。左上角起始于 (0,0) 像素,位于第 1 行第 1 列;右下角结束于 (479, 239) 像素,位于第 12 行第/_static/img/screen/brain-resolution.png列。
以下是可用模块列表:
光标打印 – 显示文本并管理打印光标。
print on screen – Prints text, numbers, or variable values on the Brain screen.
将光标设置到屏幕上的行列 – 将光标移动到指定的行和列。
将光标移至屏幕上的下一行 – 将光标移至下一行的第 1 列。
清除屏幕上的行 – 清除指定的一行文本。
screen cursor column – Reports the column number where text will be printed.
screen cursor row – Reports the row number where text will be printed.
设置 – 更改文本和图形的外观。
清除屏幕 – 清除屏幕上的所有文字和图画。
设置屏幕字体 – 更改文本显示的字体类型和大小。
set print precision on screen – Sets how many decimal places to show when printing numbers.
set pen width on screen – Sets the thickness of drawn lines and shape outlines.
set pen / font color on screen – Sets the color of text, pixels, lines, and shape outlines.
set fill color on screen – Sets the fill color for drawn shapes.
绘图 – 在大脑屏幕上创建形状、线条和图形。
draw pixel on screen – Draws a single pixel at a coordinate.
在屏幕上绘制线条 – 在两点之间绘制一条线。
在屏幕上绘制矩形 – 使用两个角点绘制矩形。
在屏幕上绘制圆 – 绘制一个具有指定中心和半径的圆。
触摸 – 检测大脑屏幕上的触摸输入。
screen pressed – Reports whether the screen is currently being touched.
screen position – Reports the selected x or y coordinate of the last screen press.
当屏幕 – 当屏幕被按下或释放时运行附加的模块。
光标打印#
屏幕打印#
The print on screen stack block prints text, numbers, or variable values on the Brain screen at the current cursor position and font.
当开始
在屏幕上打印 [VEXcode]▶
参数 |
描述 |
|---|---|
价值 |
要在屏幕上显示的文本、数字或变量值。 |
and set cursor to next row |
Select the arrow ( ▶ ) to expand the block to say and set cursor to next row, so the cursor moves to column 1 of the next row after printing. |
例子
当开始
[Display a message at the starting cursor position.]
在屏幕上打印 [Hello, Robot!]▶

将光标设置到屏幕上的行列#
The set cursor to row column on screen stack block moves the cursor to a specific row and column on the Brain screen. The next print on screen block will start printing at that location. How many rows and columns can comfortably fit depends on the selected font. With the default monospaced medium font, up to 8 rows and 13 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 on screen stack block positions the cursor based on row and column size, not font style. The font size can be adjusted using the set font on screen stack block.
在屏幕上设定光标至 [1] 行 [1] 列
参数 |
描述 |
|---|---|
排 |
The row to move the cursor to. |
柱子 |
The column to move the cursor to. |
例子
当开始
[Display text starting at Row 3 Column 12.]
在屏幕上设定光标至 [3] 行 [12] 列
在屏幕上打印 [Row 3, Column 12]▶

将光标移至屏幕上的下一行#
The set cursor to next row on screen stack block moves the cursor to column 1 on the next row on the Brain screen.
在屏幕上设定光标至下一行
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display two lines of text.]
在屏幕上打印 [Line 1]▶
在屏幕上设定光标至下一行
在屏幕上打印 [Line 2]▶

屏幕上的清除行#
The clear row on screen stack block clears a single row of text on the Brain screen.
清除屏幕第 [1] 行
参数 |
描述 |
|---|---|
排 |
要清除的行号。 |
例子
当开始
[Only keep the text on row 1.]
在屏幕上打印 [This text stays]▶
在屏幕上设定光标至下一行
在屏幕上打印 [This text disappears]▶
等待 [3] 秒
清除屏幕第 [2] 行
屏幕光标列#
The screen cursor column reporter block reports the column number where text will be printed as an integer.
(屏幕光标列数)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display the cursor's current column.]
在屏幕上设定光标至 [3] 行 [15] 列
在屏幕上打印 (屏幕光标列数)▶

屏幕光标行#
The screen cursor row reporter block reports the row number where text will be printed as an integer.
(屏幕光标行数)
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Display the cursor's current row.]
在屏幕上设定光标至 [3] 行 [2] 列
在屏幕上打印 (屏幕光标行数)▶

设置#
清晰屏幕#
The clear screen stack block clears all drawings and text from the Brain screen.
清屏
参数 |
描述 |
|---|---|
此代码块没有参数。 |
例子
当开始
[Draw a circle, and clear it after 2 seconds.]
在屏幕 [120] [120] [40] 上画圆形
等待 [2] 秒
清屏
设置屏幕上的字体#
The set font on screen stack block sets the font and size used for displaying text on the Brain screen. This font will apply to all subsequently printed text.
设定屏幕字体为 [等宽字体 v] [中 v]
参数 |
描述 |
|---|---|
风格 |
The font style: monospaced or proportional |
尺寸 |
The font size (examples below):
|
|
与上一张图片相同,但字体为 Mono 15。图中一行显示“AZ”,几乎占据了屏幕一半的宽度。左下角显示“68 列 |
与上一张图片相同,但字体为 Mono 20。图中一行显示“AZ”,占据了屏幕宽度的近三分之二。左下角显示“48 列 |
|---|---|---|
与上一张图片相同,但字体为 Mono 30。图中一行显示 AZ,几乎占据了整个屏幕宽度。左下角显示“32 列 |
与上一张图片相同,但字体为 Mono 40。图中一行显示 AX,横跨屏幕宽度。左下角显示“24 列 |
与上一张图片相同,但字体为 Mono 60。图片中一行显示 AP 字样,横跨屏幕宽度。底部显示“16 列 |
与上一张图片相同,但字体为 Prop 20。图中一行显示“AZ”,占据了屏幕宽度的近三分之二。左下角显示“48 列 12 行”。(/_static/img/fonts/prop20.png) |
|
|
|
例子
当开始
[Display text using a larger font]
设定屏幕字体为 [等宽字体 v] [特大 v]
在屏幕上打印 [VEX]▶

设置屏幕打印精度#
The set print precision on screen stack block sets how many decimal places to show when printing numbers on the Brain screen. This print precision will apply to all subsequently printed numbers.
在屏幕上设定打印精度为 [0.1 v]
参数 |
描述 |
|---|---|
精确 |
The print precision to use:
|
例子
当开始
[Print 1/3 as 0.33.]
在屏幕上设定打印精度为 [0.01 v]
在屏幕上打印 ([1] [math_division v] [3])▶

设置屏幕上的笔宽#
The set pen width on screen stack block sets the thickness of drawn lines and shape outlines.
设定屏幕笔宽为 [10]
参数 |
描述 |
|---|---|
宽度 |
The pen width, in pixels, from 0 to 32. |
例子
当开始
[Draw a rectangle with a pen width of 10.]
设定屏幕笔宽为 [10]
在屏幕 [50] [50] [130] [60] 上画矩形

设置屏幕上的笔/字体颜色#
The set pen / font color on screen stack block sets the color of text, pixels, lines, and shape outlines.
设定屏幕笔/字体颜色为 [红色 v]
参数 |
描述 |
|---|---|
颜色 |
The pen and font color to use:
|
例子
当开始
[Draw a rectangle with orange borders.]
设定屏幕笔/字体颜色为 [orange v]
在屏幕 [50] [50] [130] [60] 上画矩形

设置屏幕填充颜色#
The set fill color on screen stack block sets the fill color used when shapes are drawn.
设定屏幕填充色为 [红色 v]
参数 |
描述 |
|---|---|
颜色 |
The fill color to use:
|
示例
当开始
[Draw a purple rectangle.]
设定屏幕填充色为 [purple v]
在屏幕 [50] [130] [100] [60] 上画矩形

画#
在屏幕上绘制像素#
The draw pixel on screen stack block draws one pixel at the selected x and y coordinate using the current pen color.
在屏幕 [0] [0] 上画点
参数 |
描述 |
|---|---|
x |
绘制像素的 x 坐标,范围从 0 到 479。 |
是 |
绘制像素的 y 坐标,范围从 0 到 239。 |
例子
当开始
[Draw the pixels marking the corners of a square.]
在屏幕 [250] [100] 上画点
在屏幕 [275] [100] 上画点
在屏幕 [250] [125] 上画点
在屏幕 [275] [125] 上画点
![]()
在屏幕上画线#
The draw line on screen stack block draws a line from the first screen coordinate (x1, y1) to the second screen coordinate (x2, y2) using the current pen width and pen color.
在屏幕 [0] [0] [10] [10] 上画线段
参数 |
描述 |
|---|---|
x1 |
行首的 x 坐标(像素),范围从 0 到 479。 |
y1 |
线段起始点的 y 坐标(像素),取值范围为 0 到 239。 |
x2 |
行尾的 x 坐标(像素),范围从 0 到 479。 |
y2 |
线段末端的 y 坐标(像素),取值范围为 0 到 239。 |
例子
当开始
[Draw a line from the top left to bottom right of the screen.]
在屏幕 [0] [0] [479] [239] 上画线段

在屏幕上绘制矩形#
The draw rectangle on screen stack block draws a rectangle using the current pen width, pen color, and fill color.
在屏幕 [0] [0] [10] [10] 上画矩形
参数 |
描述 |
|---|---|
x |
矩形左上角的 x 坐标(像素),取值范围为 0 到 479。 |
是 |
矩形左上角的 y 坐标(像素),取值范围为 0 到 239。 |
宽度 |
矩形的宽度(以像素为单位)。 |
高度 |
矩形的高度(以像素为单位)。 |
例子
当开始
[Draw a rectangle on the screen.]
在屏幕 [50] [50] [130] [60] 上画矩形

在屏幕上画一个圆#
The draw circle on screen stack block draws a circle using the current pen width, pen color, and fill color.
在屏幕 [0] [0] [10] 上画圆形
参数 |
描述 |
|---|---|
x |
圆心的 x 坐标(像素值),取值范围为 0 到 479。 |
是 |
圆心的 y 坐标(像素值),取值范围为 0 到 239。 |
半径 |
圆的半径(以像素为单位)。 |
例子
当开始
[Draw a circle on the screen.]
在屏幕 [120] [120] [40] 上画圆形

触碰#
screen pressed#
The screen pressed Boolean block reports whether the Brain’s touchscreen is currently being pressed.
True – The screen is being pressed.
False – The screen is not being pressed.
<屏幕按下了?>
参数 |
描述 |
|---|---|
此代码块没有参数。 |
当开始
[Change the screen's color after it's pressed.]
等到 <屏幕按下了?>
设定屏幕填充色为 [绿色 v]
在屏幕 [0] [0] [479] [239] 上画矩形
当开始
[Display different messages after the screen is pressed.]
等到 <屏幕按下了?>
在屏幕上打印 [First message!]▶
在屏幕上设定光标至下一行
[Lift finger to press the screen again.]
等到 <非 <屏幕按下了?>>
等到 <屏幕按下了?>
在屏幕上打印 [Second message!]▶
屏幕位置#
The screen position reporter block reports the selected coordinate of the last screen press. The x-coordinate is from 0 (left) to 479 (right). The y-coordinate is from 0 (top) to 239 (bottom).
(屏幕 [X v] 坐标)
参数 |
描述 |
|---|---|
轴 |
The coordinate of the last screen press to report: x – The horizontal position or y – The vertical position |
当开始
[Display a circle where the screen is pressed.]
等到 <屏幕按下了?>
设定屏幕填充色为 [white v]
在屏幕 (屏幕 [X v] 坐标) (屏幕 [y v] 坐标) [20] 上画圆形
屏幕#
The when screen hat block runs the attached stack of blocks when the Brain screen is pressed or released.
当Brain屏幕 [pressed v] :: hat events
参数 |
描述 |
|---|---|
状态 |
When to run the attached stack of blocks: pressed runs when the screen is pressed, and released runs when the screen is released. |
当Brain屏幕 [pressed v] :: hat events
[Color the screen with polka dots by pressing it repeatedly.]
设定屏幕填充色为 [红色 v]
在屏幕 (屏幕 [X v] 坐标) (屏幕 [y v] 坐标) [20] 上画圆形



