Viewport rect

From Sim Innovations Wiki
Revision as of 12:01, 5 September 2015 by Admin (talk | contribs)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Description

viewport_rect(image_id,x,y,width,height)

viewport_rect makes an object visible within a specified frame. The frame is a rectangle.

Return value

This function won't return a value.

Arguments

# Argument Type Description
1 gui_id String The object id of which the viewport should be applied.
2 x Number This is the most left point of the canvas where the viewport starts.
3 y Number This is the most top point of the canvas where the viewport starts.
4 width Number The width of the viewport.
5 height Number The height of the viewport.

Example

-- Load and display text and images
myimage1 = img_add("myimage1.png", 0, 0, 200, 200)
myimage2 = img_add("myimage2.png", 200, 0, 200, 200)

-- Only the top left part of image1 is shown
viewport_rect(myimage1, 0, 0, 100, 100)

-- Only the top bottom right of image2 is shown
viewport_rect(myimage2, 300, 100, 100, 100)