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: John Balestrieri <mrjohn at tinrocket dot com>
Date: Tue, 27 Sep 2005 13:06:29 -0400
Delivered-to: realbasic-games at lists dot realsoftware dot com
References: <729461 dot 1127797801681 dot JavaMail dot jamninak at WMAILWEBA04>

On Sep 27, 2005, at 1:10 AM, James Noe wrote:

I have been experimenting with John Balestrieri’s SuperSpriteSurface (tinrocket.com) and have been pretty impressed. I hope that someone else who is using the control can answer a few questions.

I may be able to help. ;)

I ran into some issues when changing the height and width properties of the SuperSpriteSurface in code. After changing these properties it seems as if the screen gets scaled or sometimes seems like the position of the sprites get offset from where I expected them. If I change them in the IDE and run the same code I don’t see these issues. I was planning on allowing different size windows, and have the SuperSpriteSurface change size with the window.

Version 1.0 does not support it officially (the next version will). In the meantime, SuperSpriteSurface.Reset would reinitialize the control to draw in the correct position. The caveat is that the sprites in the control are also reset... but there might be a work around for keeping them intact:

1) Make an array of SuperSprite objects and store a reference to each item in the SuperSpriteSurface.Sprites object.
2) Update the size/location of the SuperSpriteSurface.
3) Perform SuperSpriteSurface.Reset
4) Loop through each item in the array you just made and use SuperSpriteSurface.Sprites.Append() to add it back to the SuperSpriteSurface.

I may be forgetting a few implementation details, but this approach should work. Don't hesitate to let me know if it does not.

HTH,
John

The second question is when I attempt to clone a SuperSpriteSurface in code It appears that the original SuperSpriteSurface’s properties get changed when I am trying to change properties of the new SuperSpriteSurface. For example let’s say that I have a SuperSpriteSurface called baseSSS in my window. I clone a new SuperSpriteSurface like this.

Dim MySSS as SuperSpriteSurface
mySSS = new baseSSS
mySSS.left = baseSSS.left + baseSSS.width + 10

Oddly this places mySSS directly to the right of the original baseSSS as expected, even though other SuperSpriteSurface properties can’t be changed. If I now try to change mySSS.backcolor and then run that SuperSpriteSurface, instead of affecting mySSS, baseSSS actually gets it’s backcolor changed and runs.

mySSS.backcolor = rgb(255,128,0)  //orange to be obvious
mySSS.run

The same thing happens when I try to add sprites or change anything else on mySSS. I am currently running RB 5.5.5 on MacOSX 10.3.5 and also on OS9.2.


Cloning, hmm, can you send me a demo project?

John_______________________________________________
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>