屏幕#

介绍#

The Screen blocks control the EXP Brain’s screen, allowing your robot to show text, numbers, and graphics, and respond to touch input.

默认情况下,打印到大脑的字体是等宽小号,它有7行20列。

大脑的绘图分辨率为 159 x 107 像素。

VEX Brain 屏幕的带标签网格图,显示了行、列、像素尺寸和坐标,并用红线勾勒出网格轮廓。

以下是可用模块列表:

光标打印 – 显示文本并管理打印光标。

设置 – 更改文本和图形的外观。

绘图 – 在大脑屏幕上创建形状、线条和图形。

光标打印#

将光标设置到屏幕上的行列#

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.

例子

启动时,将光标移动到屏幕上的第 3 行第 2 列,并打印“第 3 行,第 2 列”。#
当开始
[Display text starting at Row 3 Column 10.]
在屏幕上设定光标至 [3] 行 [10] 列
在屏幕上打印 [R3, C10]▶

EXP Brain 的屏幕截图,显示屏幕上打印着“R3,C10”。

将光标移至屏幕上的下一行#

The set cursor to next row on screen stack block moves the cursor to column 1 on the next row on the Brain screen.

将光标设置到下一行堆栈块#
在屏幕上设定光标至下一行

参数

描述

此代码块没有参数。

例子

启动时,屏幕上会打印“第 1 行”,将光标移动到下一行,然后打印“第 2 行”。#
当开始
[Display two lines of text.]
在屏幕上打印 [Line 1]▶
在屏幕上设定光标至下一行
在屏幕上打印 [Line 2]▶

EXP Brain 的屏幕截图,显示“第 1 行”文本打印在“第 2 行”上方。

屏幕上的清除行#

The clear row on screen stack block clears a row of text on the Brain screen.

清除行堆叠块#
清除屏幕第 [1] 行

参数

描述

要清除的行号。

例子

启动后,文本会打印在两行上。第一行会一直显示,而第二行会在 3 秒后消失。#
当开始
[Only keep the text on row 1.]
在屏幕上打印 [This text stays]▶
在屏幕上设定光标至下一行
在屏幕上打印 [This text disappears]▶
等待 [3] 秒
清除屏幕第 [2] 行

cursor column#

The cursor column reporter block reports the column number where text will be printed as a whole number.

cursor column reporter block#
(光标列数)

参数

描述

此代码块没有参数。

例子

启动时,将光标移动到屏幕上的第 3 行第 2 列,并打印当前光标所在的列号。#
当开始
[Display the cursor's current column.]
在屏幕上设定光标至 [3] 行 [10] 列
在屏幕上打印 (光标列数)▶

EXP Brain 的屏幕截图,显示第 15 列上的文本“15”。

cursor row#

The cursor row reporter block reports the row number where text will be printed as a whole number.

cursor row reporter block#
(光标行数)

参数

描述

此代码块没有参数。

例子

启动时,将光标移动到屏幕上的第 6 行第 2 列,并打印当前光标所在的行号。#
当开始
[Display the cursor's current row.]
在屏幕上设定光标至 [3] 行 [10] 列
在屏幕上打印 (光标行数)▶

EXP Brain 的屏幕截图,显示第 3 行的文本“3”。

设置#

清晰屏幕#

The clear screen stack block clears all drawings and text from the Brain screen.

clear screen stack block#
清屏

参数

描述

此代码块没有参数。

例子

启动时,绘制一个以 (120,120) 为圆心、半径为 40 像素的圆。2 秒后,屏幕清空。#
当开始
[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 text printed after this block runs.

设置字体堆栈块#
设定屏幕字体为 [等宽字体 v] [中 v]

参数

描述

风格

The font style: monospaced or proportional

尺寸

The font size (examples below):

  • extra small
  • small
  • medium
  • large
  • extra large
  • super large
Note: Extra small and small sizes are not available for proportional fonts.

大脑的屏幕以 12 号等宽字体丝网印刷数字和字母。显示 A 到 Z 以及所有数字。屏幕底部显示 9 行 26 列。
等宽特小号

大脑的屏幕以 15 号等宽字体丝网印刷数字和字母。显示 A 到 T 以及所有数字。屏幕底部显示“7 行,22 列”。
等宽小号

大脑的屏幕以 20 号 MONO 字体丝网印刷数字和字母。显示 A 到 P 以及所有数字。屏幕底部显示 5 行 16 列。
等宽中等字体

大脑的丝网印刷数字和字母,字体大小为 MONO 30。显示 A 到 J。屏幕底部显示 R:3 C:10。
等宽大号

大脑的丝网印刷数字和字母,字体大小为 MONO 40。屏幕底部显示 R:2 C:8。
等宽特大号

大脑的丝网印刷数字和字母,字体大小为 MONO 60。仅显示 MON60。
等宽超大

大脑的屏幕以 PROP 20 字体大小印刷数字和字母。显示 A 到 W 以及所有数字。屏幕底部显示 5 行 16 列。
比例中等

大脑屏幕以 PROP 30 字体大小印刷数字和字母。显示 A 到 P。屏幕底部显示 R:3 C:10。
比例大

大脑的丝网印刷数字和字母,字体大小为 PROP 40。屏幕底部显示 R:2 C:8。
比例超大

大脑的丝网印刷数字和字母,字体大小为 PROP 60。仅显示 PROP60。
比例超大

例子

启动时,将字体设置为“等宽特大号”,并在屏幕上打印“VEX”。#
当开始
[Display text using a larger font]
设定屏幕字体为 [等宽字体 v] [特大 v]
在屏幕上打印 [VEX]▶

EXP Brain 的屏幕截图,显示“VEX”字样的字体比默认字体更大。

设置屏幕打印精度#

The set print precision on screen stack block sets how many decimal places are shown when numbers are printed on the Brain screen. This print precision will apply to all numbers printed after this block runs.

设置打印精度堆栈块#
在屏幕上设定打印精度为 [0.1 v]

参数

描述

精确

The print precision to use:

  • 1
  • 0.1
  • 0.01
  • 0.001
  • All Digits

例子

启动时,将打印精度设置为小数点后两位,并在屏幕上将 1/3 打印为 0.33。#
当开始
[Print 1/3 as 0.33.]
在屏幕上设定打印精度为 [0.01 v]
在屏幕上打印 ([1] [math_division v] [3])▶

EXP Brain 的屏幕截图,显示文本“0.33”。

设置屏幕上的笔宽#

The set pen width on screen stack block sets the thickness of drawn lines and shape outlines.

set pen width stack block#
设定屏幕笔宽为 [10]

参数

描述

宽度

The pen width, in pixels, from 0 to 32.

例子

When started, sets the pen width to 10 pixels and draws a rectangle with the top-left corner at (20, 20), width 75 pixels, and height 50 pixels.#
当开始
[Draw a rectangle with a pen width of 10.]
设定屏幕笔宽为 [10]
在屏幕 [20] [20] [75] [50] 上画矩形

EXP Brain 的屏幕截图,显示一个带有粗边框的矩形。

设置屏幕上的笔/字体颜色#

The set pen / font color on screen stack block sets the color of text, pixels, lines, and shape outlines.

set pen / font color stack block#
设定屏幕笔/字体颜色为 [红色 v]

参数

描述

颜色

The pen and font color to use:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

例子

启动时,将画笔颜色设置为橙色,并绘制一个左上角位于 (50, 50) 的矩形,宽度为 130 像素,高度为 60 像素。#
当开始
[Draw a rectangle with orange borders.]
设定屏幕笔/字体颜色为 [orange v]
在屏幕 [20] [20] [75] [50] 上画矩形

EXP Brain 的屏幕截图,显示一个带有橙色边框的矩形。

设置屏幕填充颜色#

The set fill color on screen stack block sets the fill color used when shapes are drawn.

设置填充颜色堆叠块#
设定屏幕填充色为 [红色 v]

参数

描述

颜色

The fill color to use:

  • red
  • green
  • blue
  • black
  • white
  • yellow
  • orange
  • purple
  • cyan
  • transparent

示例

启动时,将填充颜色设置为紫色,并绘制一个矩形。矩形位于 (50, 130) 处,宽度为 100 像素,高度为 60 像素。#
当开始
[Draw a purple rectangle.]
设定屏幕填充色为 [purple v]
在屏幕 [20] [20] [75] [50] 上画矩形

EXP Brain 的屏幕截图,显示一个填充紫色的矩形。

#

在屏幕上绘制像素#

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

The x-coordinate to draw the pixel from 0 to 159.

The y-coordinate to draw the pixel from 0 to 107.

例子

启动时,在屏幕中心坐标 (120, 120) 处绘制一个像素。#
当开始
[Draw the pixels marking the corners of a square.]
在屏幕 [50] [50] 上画点
在屏幕 [50] [75] 上画点
在屏幕 [75] [50] 上画点
在屏幕 [75] [75] 上画点

EXP Brain 的屏幕截图,显示了构成正方形各个角点的像素组合。

在屏幕上画线#

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 到 159。

y1

线段起始点的 y 坐标(像素),取值范围为 0 到 107。

x2

行尾的 x 坐标(像素),范围从 0 到 159。

y2

线段末端的 y 坐标(像素),取值范围为 0 到 107。

例子

When started, draws a diagonal line from the top-left corner (0, 0) to the bottom-right corner (159, 107) of the screen.#
当开始
[Draw a line from the top left to bottom right of the screen.]
在屏幕 [0] [0] [159] [107] 上画线段

大脑屏幕中央出现一条细斜线,从左上角延伸到右下角。

在屏幕上绘制矩形#

The draw rectangle on screen stack block draws a rectangle using the current pen width, pen color, and fill color.

draw rectangle stack block#
在屏幕 [0] [0] [10] [10] 上画矩形

参数

描述

x

矩形左上角的 x 坐标(像素),取值范围为 0 到 159。

矩形左上角的 y 坐标(以像素为单位),取值范围为 0 到 107。

宽度

矩形的宽度(以像素为单位)。

高度

矩形的高度(以像素为单位)。

例子

When started, draws a rectangle on the screen with the top-left corner at (20, 20), width of 80 pixels, and height of 30 pixels.#
当开始
[Draw a rectangle on the screen.]
在屏幕 [20] [20] [80] [30] 上画矩形

大脑屏幕上显示一个带有细白边框的矩形。

在屏幕上画一个圆#

The draw circle on screen stack block draws a circle using the current pen width, pen color, and fill color.

画圆 堆叠方块#
在屏幕 [0] [0] [10] 上画圆形

参数

描述

x

The x-coordinate in pixels of the center of the circle from 0 to 159.

The y-coordinate in pixels of the center of the circle from 0 to 107.

半径

圆的半径(以像素为单位)。

例子

When started, draws a circle on the screen with the center at (80, 50) and a radius of 20 pixels.#
当开始
[Draw a circle on the screen.]
在屏幕 [80] [50] [20] 上画圆形

大脑屏幕上显示一个中心画有细白边的圆圈。