Pantalla#

imprimir()#

The print(value, format, …) method prints text on the screen using the current cursor position.

Parámetros

Descripción

value

El texto a imprimir.

format

Un especificador de formato que se utilizará al imprimir el valor de las variables.

Una lista variable de parámetros que se imprimirán con el especificador de formato.

Devoluciones: Ninguna.

// Print the number 1 on the Brain's screen at current
// cursor position.
Brain.Screen.print(1);

imprimirEn()#

The printAt(text, x, y, format, precision, …) method prints text at a specific x and y coordinates on the screen.

Parámetros

Descripción

value

El texto a imprimir.

x

La posición x para imprimir como argumento de palabra clave (x=), referenciada al origen de la pantalla.

y

La posición y para imprimir como argumento de palabra clave (y=), referenciada al origen de la pantalla.

format

Un especificador de formato que se utilizará al imprimir el valor de las variables.

Una lista variable de parámetros que se imprimirán con el especificador de formato.

Devoluciones: Ninguna.

// Print the number 1 on the Brain's screen at
// position (100, 40).
Brain.Screen.printAt(1, x=100, y=40);

establecerCursor()#

The setCursor(x, y) method sets the cursor position. The row and column spacing will take into account the selected font. The base cell size if 10x20 pixels for the MONO20 font. The top, left corner of the screen is position (x=1, y=1).

Parámetros

Descripción

x

La posición x del cursor.

y

La posición y del cursor.

Devoluciones: Ninguna.

establecerOrigen()#

The setOrigin(x, y) method sets the origin used for drawing graphics on the Brain’s screen. Drawing functions consider the top left corner of the Brain’s screen as the origin. This function can move the origin to an alternate position such as the center of the Brain’s screen.

Parámetros

Descripción

x

La posición x del origen relativa a la esquina superior izquierda.

y

La posición y del origen con respecto a la esquina superior izquierda.

Devoluciones: Ninguna.

establecerFuente()#

The setFont(fontname) method sets the font type used for printing text on the Brain’s screen.

Parámetros

Descripción

fontname

A valid fontType.

Devoluciones: Ninguna.

// Set the font type to mono40.
Brain.Screen.setFont(fontType::mono40);

establecerAnchoDePluma()#

The setPenWidth(width) method sets the pen width used for drawing lines, rectangles and circles.

Parámetros

Descripción

width

El ancho del bolígrafo.

Devoluciones: Ninguna.

// Set the pen width to 5 pixels.
Brain.Screen.setPenWidth(5);

establecerColorDePluma()#

El color del lápiz se puede configurar de dos maneras:

The setPenColor(color) method sets the pen color with the specified color.

Parámetros

Descripción

color

Either a previously defined colorType object or a Hex value.

Devoluciones: Ninguna.

// Set pen color red using a Hex value.
Brain.Screen.setPenColor(0xFF0000);

// Set pen color blue using a predefined color.
Brain.Screen.setPenColor(blue);

// Set pen color green using a web string.
Brain.Screen.setPenColor("#00FF00");

The setPenColor(hue) method sets the pen color with the specified hue.

Parámetros

Descripción

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

establecerColorDeRelleno()#

El color de relleno se puede configurar de dos maneras:

The setFillColor(color) method sets the fill color with the specified color.

Parámetros

Descripción

color

Either a previously defined colorType object or a Hex value.

Devoluciones: Ninguna.

// Set pen color red using a hex value.
Brain.Screen.setFillColor(0xFF0000);

// Set pen color blue using a predefined color.
Brain.Screen.setFillColor(blue);

// Set pen color green using a web string.
Brain.Screen.setFillColor("#00FF00");

The setFillColor(hue) method sets the fill color with the specified hue.

Parámetros

Descripción

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

columna()#

The column() method returns the current column where text will be printed.

Devuelve: La posición actual de la columna.

fila()#

The row() method returns the current row where text will be printed.

Devuelve: La posición de la fila actual.

obtenerAnchoDeCadena()#

The getStringWidth(string) method gets the width of a string in pixels as if it was on the Brain’s screen. The width of a string changes based on the length of the string and the size of the font.

Parámetros

Descripción

string

La cuerda a medir.

Devuelve: El ancho de la cadena como un entero.

obtenerAlturaDeCadena()#

The getStringHeight(string) method gets the height of a string in pixels as if it was on the Brain’s screen. The height of a string changes based on the length of the string and the size of the font.

Parámetros

Descripción

string

La cuerda a medir.

Devuelve: La altura de la cadena como un entero.

Borrar pantalla()#

La pantalla del cerebro se puede limpiar de tres maneras:

The clearScreen() method clears the Brain’s screen to the default color (black).

Devoluciones: Ninguna.

// Print VEXcode on the Brain's screen.
Brain.Screen.print("VEXcode");

// Clear screen to black.
Brain.Screen.clearScreen();

The clearScreen(color) method clears the whole Brain’s screen to a specified color.

Parámetros

Descripción

color

Either a previously defined colorType object or a Hex value.

Devoluciones: Ninguna.

// Print VEXcode on the Brain's screen.
Brain.Screen.print("VEXcode");

// Clear screen to blue using a predefined color.
Brain.Screen.clearScreen(blue);

The clearScreen(hue) method clears the whole Brain’s screen to a specified hue.

Parámetros

Descripción

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

clearLine()#

Las líneas se pueden borrar en la pantalla del Cerebro de cuatro maneras:

The clearLine() method clears the row where the cursor is currently located.

Devoluciones: Ninguna.

The clearLine(number) method clears a specified row.

Parámetros

Descripción

number

La fila a despejar.

Devoluciones: Ninguna.

The clearLine(number, color) method clears a specified row and sets the row to a specified color.

Parámetros

Descripción

number

La fila a despejar.

color

Un objeto color definido previamente o un valor hexadecimal.

Devoluciones: Ninguna.

The clearLine(number, hue) method clears a specified row and sets the row to a specified hue.

Parámetros

Descripción

number

La fila a despejar.

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

nuevaLínea()#

The newLine() method moves the cursor to the next row.

Devoluciones: Ninguna.

dibujarPixel()#

The drawPixel(x, y) method draws a pixel using the current pen color.

Parámetros

Descripción

x

La posición x para dibujar el píxel referenciado al origen de la pantalla.

y

La posición y para dibujar el píxel referenciado al origen de la pantalla.

Devoluciones: Ninguna.

// Draw a red pixel on the Brain's screen.
Brain.Screen.setPenColor(red);
Brain.Screen.drawPixel(10, 10);

dibujarLínea()#

The drawLine(x1, y1, x2, y2) method draws a line using the current pen color.

Parámetros

Descripción

x1

La posición x del inicio de la línea referenciada al origen de la pantalla.

y1

La posición y del inicio de la línea referenciada al origen de la pantalla.

x2

La posición x del final de la línea referenciada al origen de la pantalla.

y2

La posición y del final de la línea referenciada al origen de la pantalla.

Devoluciones: Ninguna.

// Draw a red line on the Brain's screen.
Brain.Screen.setPenColor(red);
Brain.Screen.drawLine(10, 10, 20, 20);

dibujarRectángulo()#

Se puede dibujar un rectángulo en la pantalla del Cerebro de tres maneras:

The drawRectangle(x, y, width, height) method draws a rectangle on the screen using the current pen and fill colors.

Parámetros

Descripción

x

La posición x de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

y

La posición y de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

width

El ancho del rectángulo.

height

La altura del rectángulo.

Devoluciones: Ninguna.

// Draw a green rectangle on the screen that is
// filled using blue.
Brain.Screen.setPenColor(green);
Brain.Screen.setFillColor(blue);
Brain.Screen.drawRectangle(10, 10, 20, 20);

The drawRectangle(x, y, width, height, color) method draws a rectangle on the screen using the current pen and fills the circle with the specified color.

Parámetros

Descripción

x

La posición x de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

y

La posición y de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

width

El ancho del rectángulo.

height

La altura del rectángulo.

color

Un objeto color definido previamente o un valor hexadecimal.

Devoluciones: Ninguna.

The drawRectangle(x, y, width, height, hue) method draws a rectangle on the screen using the current pen and fills the circle with the specified hue.

Parámetros

Descripción

x

La posición x de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

y

La posición y de la esquina superior izquierda del rectángulo referenciada al origen de la pantalla.

width

El ancho del rectángulo.

height

La altura del rectángulo.

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

dibujarCírculo()#

Se puede dibujar un círculo en la pantalla del Cerebro de tres maneras:

The drawCircle(x, y, radius) method draws a circle using the current pen and fill colors.

Parámetros

Descripción

x

La posición x del centro del círculo referenciado al origen de la pantalla.

y

La posición y del centro del círculo referenciada al origen de la pantalla.

radius

El radio del círculo en píxeles.

Devoluciones: Ninguna.

// Draw a green circle on the Brain's screen that is
// filled using blue.
Brain.Screen.setPenColor(green);
Brain.Screen.setFillColor(blue);
Brain.Screen.drawCircle(50, 50, 10);

The drawCircle(x, y, radius, color) method draws a circle using the current pen color and fills the circle with the specified color.

Parámetros

Descripción

x

La posición x del centro del círculo referenciado al origen de la pantalla.

y

La posición y del centro del círculo referenciada al origen de la pantalla.

radius

El radio del círculo en píxeles.

color

Un objeto color definido previamente o un valor hexadecimal.

Devoluciones: Ninguna.

The drawCircle(x, y, radius, hue) method draws a circle using the current pen color and fills the circle with the specified hue.

Parámetros

Descripción

x

La posición x del centro del círculo referenciado al origen de la pantalla.

y

La posición y del centro del círculo referenciada al origen de la pantalla.

radius

El radio del círculo en píxeles.

hue

Un número entero que representa el tono del color, de 1 a 359.

Devoluciones: Ninguna.

invertirCírculo()#

The invertCircle(x, y, radius) method inverts a circular area of the screen using the specified points and attributes set in the parameters.

Parámetros

Descripción

x

La ubicación central x del círculo.

y

La ubicación central del círculo.

radius

Establece el radio del círculo que se dibujará en la pantalla.

// Invert a circle at (30, 30) with radius 10.
Brain.Screen.invertCircle(30, 30, 10);

invertirRectángulo()#

The invertRectangle(x, y, width, height) method inverts a rectangular area of the screen using the specified points and attributes set in the parameters.

Parámetros

Descripción

x

La coordenada x en la que se dibujará el borde izquierdo del rectángulo en la pantalla.

y

La coordenada y en la que se dibujará el borde superior del rectángulo en la pantalla.

width

El ancho del rectángulo.

height

La altura del rectángulo.

// Invert a rectangle at (10, 10) with width 50 and height 20.
Brain.Screen.invertRectangle(10, 10, 50, 20);

establecerCompensaciónDeAspecto()#

The setAspectCompensation(value) method compensates for non-square pixels when drawing.

Parámetro

Descripción

value

true or false.

// Set aspect compensation to true.
Brain.Screen.setAspectCompensation(true);