SetScissorClip
From OxeyeWiki
(Difference between revisions)
(Created page with '{{VideoMethod | video.setScissorClip(x, y, width, height) | Sets the video device's "scissor clip" area. This area is a rectangle on the screen in which rendering should be allow...') |
|||
(One intermediate revision not shown) | |||
Line 1: | Line 1: | ||
{{VideoMethod | {{VideoMethod | ||
| | | | ||
- | video.setScissorClip( | + | video.setScissorClip(left, top, right, bottom) |
| | | | ||
Sets the video device's "scissor clip" area. This area is a rectangle on the screen in which rendering should be allowed. All pixels that are rendered outside of this rectangle will not be displayed. | Sets the video device's "scissor clip" area. This area is a rectangle on the screen in which rendering should be allowed. All pixels that are rendered outside of this rectangle will not be displayed. | ||
Line 9: | Line 9: | ||
Use [[clearScissorClip]] to reset the clip again. | Use [[clearScissorClip]] to reset the clip again. | ||
| | | | ||
- | {{MethodParam| | + | {{MethodParam|left|An integer|The left edge of the rectangle (inclusive).}} |
- | {{MethodParam| | + | {{MethodParam|top|An integer|The top edge of the rectangle (inclusive).}} |
- | {{MethodParam| | + | {{MethodParam|right|An integer|The right edge of the rectangle (exclusive).}} |
- | {{MethodParam| | + | {{MethodParam|bottom|An integer|The bottom edge of the rectangle (exclusive).}} |
| | | | ||
Returns nothing. | Returns nothing. |
Latest revision as of 02:05, 25 January 2010
video.setScissorClip(left, top, right, bottom) | ||
Sets the video device's "scissor clip" area. This area is a rectangle on the screen in which rendering should be allowed. All pixels that are rendered outside of this rectangle will not be displayed. The scissor clip can be used, for example, to create split-screen multiplayer. To do this, render the whole game twice, using an on-screen off-set for the second half. See the example below. Use clearScissorClip to reset the clip again. | ||
Parameter | Expected Type | Description |
left | An integer | The left edge of the rectangle (inclusive). |
top | An integer | The top edge of the rectangle (inclusive). |
right | An integer | The right edge of the rectangle (exclusive). |
bottom | An integer | The bottom edge of the rectangle (exclusive). |
Returns | ||
Returns nothing. |
Example
local function renderSplit(offsetX, offsetY) -- render all sprites etc end local function renderAll() local screenW, screenH = video.getScreenSize() -- split vertically (one view on the left and one on the right) local halfWidth = screenW / 2 -- render player A's view video.setScissorClip(0, 0, halfWidth, screenH) renderSplit(0, 0) -- render player B's view video.setScissorClip(halfWidth, 0, screenW, screenH) renderSplit(halfWidth, 0) -- reset clip video.clearScissorClip() -- render shared stuff here, such as top layer GUI etc end