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 [2018/06/15 21:33]
ldentityunknown getViewport+setViewport
component:gpu [2018/11/25 16:48]
evg-zhabotinsky
Line 41: Line 41:
   Gets the currently set resolution.   Gets the currently set resolution.
 - `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 changed (may return `false` if an attempt was made to set it to the same value it was set before), `false` otherwise.
 - `getViewport():​ number, number`  ​ - `getViewport():​ number, number`  ​
   Get the current viewport resolution.   Get the current viewport resolution.
-- `setViewport(number,​ number)` ​  +- `setViewport(width: ​number, ​height: ​number): boolean`   
-  Set the current viewport resolution.+  Set the current viewport resolution. Returns `true` if it was changed (may return `false` if an attempt was made to set it to the same value it was set before), `false` otherwise. This makes it look like screen resolution is lower, but the actual resolution stays the same. Characters outside top-left corner of specified size are just hidden, and are intended for rendering or storing things off-screen and copying them to the visible area when needed. Changing resolution will change viewport to whole screen.
 - <​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.