GPU T1

Building Type

GPU

Build Gun In Game
300
300

This computer module is a GPU and allows you to render a character grid onto any kind of screen. Each character can have it’s own background and foreground color.

You can also change the resolution to up to 150x50 characters.

If the bound monitor allows for it, the GPU can also have user input like mouse clicks, keyboard key strokes or just simple mouse movement over the screen. "Touch input" by looking/clicking with the crosshair over/onto a screen in the world is also supported.

To define the color of a character, you need to set the currently used foreground and background color. All further character changes cause the changed character to have the currently used foreground and background colors. If you change the currently used foreground and background color, the color of the already drawn/changed characters wont change. (Until you draw them again)

When you do changes, those changes will only occur on a hidden buffer. That means you need to call flush() after you have changes something and want to display it.

Interface

Parent

Functions

Set Text setText (Int X x, Int Y y, String String str)

Draws the given text at the given position to the hidden screen buffer.

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Parameters
Name Type Description

X x

Int

The x coordinate at which the text should get drawn.

Y y

Int

The y coordinate at which the text should get drawn.

String str

String

The text you want to draw on-to the buffer.

Set Size setSize (Int Width w, Int Height h)

Changes the size of the text-grid (and buffer).

Flags

RuntimeSync RuntimeParallel

Parameters
Name Type Description

Width w

Int

The width of the text-gird.

Height h

Int

The height of the text-grid.

Set Foreground Color setForeground (Float Red r, Float Green g, Float Blue b, Float Alpha a)

Changes the foreground color that is used for the next draw calls.

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Parameters
Name Type Description

Red r

Float

The red portion of the foreground color. (0.0 - 1.0)

Green g

Float

The green portion of the foreground color. (0.0 - 1.0)

Blue b

Float

The blue portion of the foreground color. (0.0 - 1.0)

Alpha a

Float

The opacity of the foreground color. (0.0 - 1.0)

Set Buffer setBuffer (Struct(GPUT1Buffer) Buffer buffer)

Allows to change the back buffer of the GPU to the given buffer.

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Parameters
Name Type Description

Buffer buffer

Struct(GPUT1Buffer)

The Buffer you want to now use as back buffer.

Set Background Color setBackground (Float Red r, Float Green g, Float Blue b, Float Alpha a)

Changes the background color that is used for the next draw calls.

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Parameters
Name Type Description

Red r

Float

The red portion of the background color. (0.0 - 1.0)

Green g

Float

The green portion of the background color. (0.0 - 1.0)

Blue b

Float

The blue portion of the background color. (0.0 - 1.0)

Alpha a

Float

The opacity of the background color. (0.0 - 1.0)

Get Size getSize (Int Width w out, Int Height h out)

Returns the size of the text-grid (and buffer).

Flags

RuntimeSync RuntimeParallel

Return Values
Name Type Description

Width w

Int out

The width of the text-gird.

Height h

Int out

The height of the text-grid.

Get Screen getScreen (Object(Object) Screen screen out)

Returns the currently bound screen.

Flags

RuntimeSync RuntimeParallel

Return Values
Name Type Description

Screen screen

Object(Object) out

The currently bound screen.

Get Buffer getBuffer (Struct(GPUT1Buffer) Buffer buffer out)

Returns the back buffer as struct to be able to use advanced buffer handling functions. (struct is a copy)

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Return Values
Name Type Description

Buffer buffer

Struct(GPUT1Buffer) out

The Buffer that is currently the back buffer.

Flush flush ()

Flushes the hidden screen buffer to the visible screen buffer and so makes the draw calls visible.

Flags

RuntimeSync RuntimeParallel

Fill fill (Int X x, Int Y y, Int DX dx, Int DY dy, String String str)

Draws the given character at all given positions in the given rectangle on-to the hidden screen buffer.

Flags

RuntimeSync RuntimeParallel RuntimeAsync

Parameters
Name Type Description

X x

Int

The x coordinate at which the rectangle should get drawn. (upper-left corner)

Y y

Int

The y coordinate at which the rectangle should get drawn. (upper-left corner)

DX dx

Int

The width of the rectangle.

DY dy

Int

The height of the rectangle.

String str

String

The character you want to use for the rectangle. (first char in the given string)

Bind Screen bindScreen (Trace New Screen newScreen)

Binds this GPU to the given screen. Unbinds the already bound screen.

Flags

RuntimeSync RuntimeParallel

Parameters
Name Type Description

New Screen newScreen

Trace

The screen you want to bind this GPU to. Null if you want to unbind the screen.

Signals

Screen Size Changed ScreenSizeChanged (Int old Width oldW, Int old Height oldH)

Triggers when the size of the text grid changed.

Flags

Parameters
Name Type Description

old Width oldW

Int

The old width of the screen.

old Height oldH

Int

The old height of the screen.

On Mouse Up OnMouseUp (Int X x, Int Y y, Int Button btn)

Triggers when a mouse button got released.

Flags

Parameters
Name Type Description

X x

Int

The x position of the cursor.

Y y

Int

The y position of the cursor.

Button btn

Int

The Button-Bit-Field providing information about the released button event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed

On Mouse Move OnMouseMove (Int X x, Int Y y, Int Button btn)

Triggers when the mouse cursor moves on the screen.

Flags

Parameters
Name Type Description

X x

Int

The x position of the cursor.

Y y

Int

The y position of the cursor.

Button btn

Int

The Button-Bit-Field providing information about the move event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed

On Mouse Down OnMouseDown (Int X x, Int Y y, Int Button btn)

Triggers when a mouse button got pressed.

Flags

Parameters
Name Type Description

X x

Int

The x position of the cursor.

Y y

Int

The y position of the cursor.

Button btn

Int

The Button-Bit-Field providing information about the pressed button event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed

On Key Up OnKeyUp (Int C c, Int Code code, Int Button btn)

Triggers when a key got released.

Flags

Parameters
Name Type Description

C c

Int

The ASCII number of the character typed in.

Code code

Int

The number code of the pressed key.

Button btn

Int

The Button-Bit-Field providing information about the key release event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed

On Key Down OnKeyDown (Int C c, Int Code code, Int Button btn)

Triggers when a key got pressed.

Flags

Parameters
Name Type Description

C c

Int

The ASCII number of the character typed in.

Code code

Int

The number code of the pressed key.

Button btn

Int

The Button-Bit-Field providing information about the key press event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed

On Key Character OnKeyChar (String Character c, Int Button btn)

Triggers when a character key got 'clicked' and essentially a character got typed in, usful for text input.

Flags

Parameters
Name Type Description

Character c

String

The character that got typed in as string.

Button btn

Int

The Button-Bit-Field providing information about the key release event.
Bits:
1th left mouse pressed
2th right mouse button pressed
3th ctrl key pressed
4th shift key pressed
5th alt key pressed
6th cmd key pressed