Jump to content

Gpu: Difference between revisions

From Advanced Computers Wiki
No edit summary
No edit summary
Line 91: Line 91:
|Pastes the given text <code>uText</code> at the given position with the given pasteMode <code>mode</code>. Returns the position directly after the pasted text. So when performing multiple paste-operations you likely want to supply the previously returned position as the next position argument.
|Pastes the given text <code>uText</code> at the given position with the given pasteMode <code>mode</code>. Returns the position directly after the pasted text. So when performing multiple paste-operations you likely want to supply the previously returned position as the next position argument.
|-
|-
|<code>:pasteText(x:int, y:int, mode:PasteMode, uText:string)</code>
|<code>:pasteText(uText:string)</code>
|<code>x:int, y:int</code>
|<code>x:int, y:int</code>
|
|Shorthand for: <code>:pasteText(0, 0, uText)</code>
|-
|-
|<code>:pasteText(x:int, y:int, mode:PasteMode, uText:string)</code>
|<code>:pasteText(x:int, y:int, uText:string)</code>
|<code>x:int, y:int</code>
|<code>x:int, y:int</code>
|
|Shorthand for: <code>:pasteText(x, y, PasteMode.STOP, uText)</code>
|}
|}


{{Navbox content}}
{{Navbox content}}

Revision as of 14:43, 18 August 2026

The GpuUD component is what allows for rendering to screens. It offers the following functionality:

GpuUD component properties
Name Type Read/Write Description
remainingVideoRam integer READ The amount of video ram remaining. Every alive buffer requires a certain amount of video memory.
GpuUD component methods
Name Returns Description
:newBuffer(integer:width, integer:height) TextBufferUD Attempts to allocate and return a new TextBuffer of the given size.
:assignBuffer(textBufferUD, screenBlockUD:screenComponent) void Assigns the given textBuffer to the given Screen, displaying the contents on the screen.
:freeAllBuffers() int Frees all buffers allocated by this GPU and returns the number of freed buffers.

TextBufferUD

You can interact with textBuffers using the following api:

TextBufferUD properties
Name Type Read/Write Description
width int READ The width/height of this buffer, as specified in GpuUD:newBuffer(...).
height int READ
isAlive bool READ Whether this buffer is still alive, i.e. has not been deleted yet via :free().

In the following, x refers to the horizontal axis (like width) and y refers to the vertical axis (like height).

TextBufferUD methods
Name Returns Description
:getTextAsString() string Returns the entire content of this buffer as a single string.
:free() void Deletes this buffer, releasing the held video memory.
:getFg(x:int, y:int) byte Returns the foreground color of this position. Currently does not have any visible effect.
:getBg(x:int, y:int) byte Returns the background color of this position. Currently does not have any visible effect.
:getText(x:int, y:int) char Returns a single-letter string representing the letter stored at this position.
:set(x:int, y:int, chr:char, fgColor:byte, bgColor: byte) void Sets the given position's character data, foreground and background color. Any arguments except for the position may be nil and will then have no effect. Color rendering is currently not implemented.
:rotRows(cnt:int) void Rotates the lines of the buffer, allowing for efficient implementation of scrolling.
:clearRow(line:int) void Clears the given line, resetting colors and text content of all positions of the given line.
:newline() void Shorthand for: clearRow(0); rotRows(1);
:pasteText(x:int, y:int, mode:PasteMode, uText:string) x:int, y:int Pastes the given text uText at the given position with the given pasteMode mode. Returns the position directly after the pasted text. So when performing multiple paste-operations you likely want to supply the previously returned position as the next position argument.
:pasteText(uText:string) x:int, y:int Shorthand for: :pasteText(0, 0, uText)
:pasteText(x:int, y:int, uText:string) x:int, y:int Shorthand for: :pasteText(x, y, PasteMode.STOP, uText)