Difference between revisions of "Viewport rect"

From Sim Innovations Wiki
Jump to navigation Jump to search
m
 
Line 1: Line 1:
 
== Description ==
 
== Description ==
  
  '''viewport_rect(image_id,x,y,width,height)'''
+
  '''viewport_rect(node_id,x,y,width,height)'''
  
'''viewport_rect''' makes an object visible within a specified frame. The frame is a rectangle.
+
'''viewport_rect''' makes a node visible within a specified frame. The frame is a rectangle.
  
 
== Return value ==  
 
== Return value ==  
Line 16: Line 16:
 
! # !! Argument !! Type !! Description
 
! # !! Argument !! Type !! Description
 
|-
 
|-
| 1 || '''gui_id''' || ''String'' || The object id of which the viewport should be applied.
+
| 1 || '''node_id''' || ''ID'' || The node id of which the viewport should be applied.
 
|-
 
|-
 
| 2 || '''x''' || ''Number'' || This is the most left point of the canvas where the viewport starts.
 
| 2 || '''x''' || ''Number'' || This is the most left point of the canvas where the viewport starts.

Latest revision as of 09:53, 12 July 2018

Description

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

viewport_rect makes a node visible within a specified frame. The frame is a rectangle.

Return value

This function won't return a value.

Arguments

# Argument Type Description
1 node_id ID The node 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)