realbasic-games
[Top] [All Lists]

Re: SuperSpriteSurface Resizing and Cloning in Code

To: REALbasic Games <realbasic-games at lists dot realsoftware dot com>
Subject: Re: SuperSpriteSurface Resizing and Cloning in Code
From: Jesse Simko <jms98 at hampshire dot edu>
Date: Tue, 27 Sep 2005 22:43:03 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <7243012 dot 1127867087457 dot JavaMail dot jamninak at WMAILWEBA04>

On Sep 27, 2005, at 8:24 PM, James Noe wrote:


Jesse Simko wrote:



If you change the aspect ratio of a SuperSpriteSurface while scaling it, the sprites will be stretched and distoreted. But scaling the SuperSpriteSurface without changing its aspect ratio works great. (You still might need to call "reset" to make it look right.) That's why in my game engine, every screen setting conforms to a 4:3 aspect ratio.
--Jesse




That’s a good tip. That matches what I am seeing on my screen. Does that cause the sprites to also get scaled with the size of the SuperSpriteSurface? I can see situations where you would want that behavior and situations where you wouldn’t want it. I imagine if the sprites are scaled you could always iterate through all of the sprites and change it back to 1 if that is what you are looking for.

As I was trying to come to grips with this I tried making the SuperSpriteSurface as large as my largest window size and if I made my window size smaller, I made sure in code to keep all of the sprites in the visible portion of the surface. This worked Ok for my simple demo project but may use up more graphic memory. I am not sure if portions of the surface outside the window border get culled or not. If you want your sprites scaled you also need to do that in code as well, to match the new window size.

Thanks, Jim



In order to scale sprites along with the SuperSpriteSurface, you would have to do something like this:

SuperSpriteSurface1.sprites.scale = 1 / (SuperSpriteSurface1.width / 1024)

(In this case, 1024 was the width of the SuperSpriteSurface at the start of the game.) That's what I had did to make sprites scale in the Power Game Factory game engine, and it's worked out pretty well.
 --Jesse
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>