Beginning Game Programming, Third Edition by Jonathan S. Harbour

Beginning Game Programming, Third Edition by Jonathan S. Harbour

Author:Jonathan S. Harbour
Language: eng
Format: epub
Publisher: Course Technology
Published: 2010-08-17T04:00:00+00:00


D3DXVECTOR2 center( (width*scaling) / 2.0f, (height*scaling) / 2.0f);

In this example, you can see that the width and height is being multiplied by the scaling factor before being divided by two (to, presumably, give us the center point). If you do not change the scale of the sprite at all, then you may leave out the scaling. But, to be thorough, I’ve included it here so that if you do want to scale a sprite smaller or larger, as well as rotate it, then it will look correct. Otherwise, without this scale factor, the rotation will be distorted.

You may scale the sprite differently in the horizontal and vertical axes if you wish by using a different scale value for the width and height. Since this is seldom done, I have just coded the scaling to use the same scale factor for both width and height.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.