Thursday, 5 April 2012

Screen and Object Sizes

Lets have another look at the result from our first project
It might seem a lot bigger than expected, given that the original image was only 64 x 64 pixels.

This is because the sprite containing the image has been scaled up to match the percentage coordinate system which has set the screen size to 100 x 100 Units.  I put Units here as Pixels are out of the window when using percentages as I will now demonstrate.

The file setup.agc sets the screen size for the windows environment.  Let's take a look at it by double clicking on setup.agc in the project tree.
As you can see, the screen width is set to 320 pixels and the height to 480 pixels.

The sprite shown above is has been scaled to 64% of the screen width.

320 x 64% = 204.8 pixels.

So the sprite is being drawn 204.8 Pixels wide.

But how high is it?  it still looks square so it can't be 64% of the height as well.

Remember the SetDisplayAspect( 0.66 ) command?  Well...

64% x 0.66 = 42.24 %

So the sprite has also been scaled to 42.24% of the screen height.

480 x 42.24% = 202.752 pixels.

Which is why the sprite still looks square.  It is being drawn at 204.8 X 202.8 Pixels

But enough of the maths, I don't like this coordinate system so let's get rid of it.

Oh and you can close setup.agc, we're done with it for now.  Just click the little cross on the right of it's tab  at the top of the edit window.

No comments:

Post a Comment