AGK for Pascal
ContentsIndexHome
PreviousUpNext
TAgkSprite.SetSize Method

Sets the sprite to a new width and height. In the default coordinate system a width and height of 100,100 would fill the entire drawable screen (this can be changed using TAgkApplication.SetVirtualResolution).

Syntax
Pascal
procedure SetSize(const Width: Single = -1; const Height: Single = -1);
Parameters 
Description 
const Width: Single = -1 
the new width, or -1 to calculate the width (see Remarks), 
const Height: Single = -1 
the new height, or -1 to calculate the height (see Remarks), 

If either Width or Height is set, with the other set to -1, the -1 value will be recalculated to maintain the image's aspect ratio so it doesn't look stretched. If both Width and height are set to -1, then the sprite will take on the width of the assigned image and calculate its height so it isn't stretched. 

This function recalculates the sprite's collision shape, which can be a costly process for circle and polygon shapes. A more efficient way to change the size of a sprite is to scale it using the SetScale method. This method resets the scale of the sprite.

Copyright (c) 2012. All rights reserved.