Programming Course for Beginners - ZedLX

The Easiest Online Computer Programming Course, for Free

Images and Sprites [2/8]

The member function .draw from type image copies the image to the screen. It can accept 1 arguments or 2 arguments.

The first argument is obligatory. It is of type point2D and specifies the position on the screen where the top left corner of image copy is to be placed.

The second arguments is optional. It is of type vector2D and specifies the size of the image copy. If the second argument is ommited, then the size of the original is used.

In this program, all arguments of member function .draw are given by initializers of types point2D and vector2D.

The second argument can be used to stretch or resize the image.