Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
component:gpu [2017/03/27 23:55]
payonel [Palette Color]
component:gpu [2018/06/15 21:33]
ldentityunknown getViewport+setViewport
Line 42: Line 42:
 - `setResolution(width:​ number, height: number): boolean`  ​ - `setResolution(width:​ number, height: number): boolean`  ​
   Sets the specified resolution. Can be up to the maximum supported resolution. If a larger or invalid resolution is provided it will throw an error. Returns `true` if the resolution was set, `false` otherwise.   Sets the specified resolution. Can be up to the maximum supported resolution. If a larger or invalid resolution is provided it will throw an error. Returns `true` if the resolution was set, `false` otherwise.
 +- `getViewport():​ number, number`  ​
 +  Get the current viewport resolution.
 +- `setViewport(number,​ number)`  ​
 +  Set the current viewport resolution.
 - <​del>​`getSize():​ number, number`  ​ - <​del>​`getSize():​ number, number`  ​
   Gets the size in blocks of the screen the graphics card is bound to. For simple screens and robots this will be one by one.</​del>​ Deprecated, use `screen.getAspectRatio()` instead.   Gets the size in blocks of the screen the graphics card is bound to. For simple screens and robots this will be one by one.</​del>​ Deprecated, use `screen.getAspectRatio()` instead.
Line 68: Line 72:
  
 GPU Color Depth GPU Color Depth
------------+==============
  
 Color Depth (see `gpu.setDepth` and `gpu.getDepth`) can be 1, 4, or 8 bits separately for foreground and background. These depths provide 2, 16, and 256 colors respectively. Color Depth (see `gpu.setDepth` and `gpu.getDepth`) can be 1, 4, or 8 bits separately for foreground and background. These depths provide 2, 16, and 256 colors respectively.
Line 75: Line 79:
  
 RGB Color RGB Color
-============+-----------
 The background and foreground colors, as set by calling `setBackground` and `setForeground`,​ are defined by a `value` (number) and `is_palette` (boolean) pair (the boolean being optional). The background and foreground colors, as set by calling `setBackground` and `setForeground`,​ are defined by a `value` (number) and `is_palette` (boolean) pair (the boolean being optional).
  
Line 85: Line 89:
  
 Palette Color Palette Color
-============+-----------
 When `is_palette` is `true`, `value` is interpreted as palette index [0, 16). If you switch from a higher bit density to monochrome note that the color value from the palette is used to determine zero vs the nonzero monochrome color. It is an error to specify a paletted color (i.e. an index value and `true`) in 1 bit depth. When `is_palette` is `true`, `value` is interpreted as palette index [0, 16). If you switch from a higher bit density to monochrome note that the color value from the palette is used to determine zero vs the nonzero monochrome color. It is an error to specify a paletted color (i.e. an index value and `true`) in 1 bit depth.
  
 Changing Depth Changing Depth
-============+-----------
  
 Note that the original color pair (the value `number` and palette `bool`) are preserved (background and foreground each) even when switching bit depths. The actual rendering on the screen will update to respect the new depth, but the original 24bit rgb value (or palette index) is not lost. For example, calling `gpu.getBackground` while in 1 bit mode will return the original 24 bit rgb value specified from any previous color depth. Note that the original color pair (the value `number` and palette `bool`) are preserved (background and foreground each) even when switching bit depths. The actual rendering on the screen will update to respect the new depth, but the original 24bit rgb value (or palette index) is not lost. For example, calling `gpu.getBackground` while in 1 bit mode will return the original 24 bit rgb value specified from any previous color depth.