Description
This is the component provided by graphics cards.
Component name: gpu
.
This is the component provided by graphics cards.
Component name: gpu
.
bind(address: string[, reset: boolean=true]): boolean[, string]
Tries to bind the GPU to a screen with the specified address. Returns true on success, false and an error message on failure. Resets the screen's settings if reset is 'true'. A GPU can only be bound to one screen at a time. All operations on it will work on the bound screen. If you wish to control multiple screens at once, you'll need to put more than one graphics card into your computer.
getScreen():string
Get the address of the screen the GPU is bound to. Since 1.3.2.
getBackground(): number, boolean
Gets the current background color. This background color is applied to all “pixels” that get changed by other operations.setBackground(color: number[, isPaletteIndex: boolean]): number[, index]
Sets the background color to apply to “pixels” modified by other operations from now on. getForeground(): number, boolean
Like getBackground, but for the foreground color.
setForeground(color: number[, isPaletteIndex: boolean]): number[, index]
Like setBackground, but for the foreground color.
getPaletteColor(index: number): number
Gets the RGB value of the color in the palette at the specified index.
setPaletteColor(index: number, value: number): number
Sets the RGB value of the color in the palette at the specified index.
maxDepth(): number
Gets the maximum supported color depth supported by the GPU and the screen it is bound to (minimum of the two).
getDepth(): number
The currently set color depth of the GPU/screen, in bits. Can be 1, 4 or 8.
setDepth(bit: number): string
Sets the color depth to use. maxResolution(): number, number
Gets the maximum resolution supported by the GPU and the screen it is bound to (minimum of the two).
getResolution(): number, number
Gets the currently set resolution.
setResolution(width: number, height: number): boolean
Sets the specified resolution.getViewport(): number, number
Get the current viewport resolution.
setViewport(width: number, height: number): boolean
Set the current viewport resolution. getSize(): number, number
Gets the size in blocks of the screen the graphics card is bound to. get(x: number, y: number): string, number, number, number or nil, number or nil
Gets the character currently being displayed at the specified coordinates.set(x: number, y: number, value: string[, vertical:boolean]): boolean
Writes a string to the screen, starting at the specified coordinates. copy(x: number, y: number, width: number, height: number, tx: number, ty: number): boolean
Copies a portion of the screens buffer to another location. fill(x: number, y: number, width: number, height: number, char: string): boolean
Fills a rectangle in the screen buffer with the specified character.getActiveBuffer(): number
Returns the index of the currently selected buffer. setActiveBuffer(index: number): number
Sets the active buffer to index.buffers(): table
Returns an array of all current page indexes (0 is not included in this list, that is reserved for the screen).
allocateBuffer([width: number, height: number]): number
Allocates a new buffer with dimensions width*heigh (gpu max resolution by default). freeBuffer([index: number]): boolean
Removes buffer at index (default: current buffer index).freeAllBuffers()
Removes all buffers, freeing all video memory. totalMemory(): number
Returns the total memory size of the gpu vram. freeMemory(): number
Returns the total free memory not allocated to buffers. getBufferSize([index: number]): number, number
Returns the buffer size at index (default: current buffer index). bitblt([dst: number, col: number, row: number, width: number, height: number, src: number, fromCol: number, fromRow: number])
Copy a region from buffer to buffer, screen to buffer, or buffer to screen. Defaults: