Class Size

Size represents an area in two dimensional space. Its members are width and height, which are non-negative integers.

CONSTRUCTION

COMPARISION

OTHER METHODS

Example

main

  size s1 = 0, 0
  size s2 = 10, 50

  size s3 = screen.get size
  print s3.get width          // LOG: 240
  print s3.get height         // LOG: 320
            

(size) <size sourceSize>.copy

Creates a new size that is an exact copy of sourceSize.

Parameters

Return value

Example

main
  size s1 = 10,20
  size s2 = s1.copy     // Size having width 10 and height 20
            

(size) <int width>, <int height>

Creates a new size with the given width and height.

Parameters

Return value

Exceptions

Example

main
  size s = 10,20       // Size having width 10 and height 20
            

(bool) <size s1> == <size s2>

Comparision

Parameters

Return value

Example

main
  size s1 = 10,20
  size s2 = 20,10
  bool result = s1 == s2    // result == false
                    

(bool) <size s1> != <size s2>

Comparision

Parameters

Return value

Example

main
  size s1 = 10,20
  size s2 = 20,10
  bool result = s1 != s2    // result == true
                    

(int) get width

Get the value of the width.

Return value

Example

main
  size s = 10,20
  int width = s.get width     // width == 10
          

(int) get height

Get the value of the height.

Return value

Example

main
  size s = 10,20
  int height = s.get height     // height == 20
          

set width to <int newWidth>

Assing a new value for the width.

Parameters

Exceptions

Example

main
  size s = 10,20
  s.set width to 100    // s == 100, 20
            

set height to <int newHeight>

Assing a new value for the height.

Parameters

Exceptions

Example

main
  size s = 10,20
  s.set height to 100    // s == 10, 100