Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Tue Aug 20, 2019 8:38 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Wed Nov 12, 2008 10:14 am 
Offline
User avatar

Joined: Sun Mar 23, 2008 3:30 pm
Posts: 163
I have two questions about SuperSpriteSurface 2 beta 2

I made a resizable window with a SuperSpriteSurface placed on it, and it is set to resize along with the window. However, when a user does this, the sprites become distorted and zoomed in. Is there a way to keep the sprites the size they're supposed to be? I imagine this is the same for any OpenGL surface in RealBasic. I just can't figure out what's going on here.

Also, is there a way to always keep a sprite above all other sprites, even ones created after it?

Thanks for any help!


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Wed Nov 12, 2008 11:51 pm 
Offline

Joined: Tue Sep 09, 2008 1:43 am
Posts: 39
Quote:
Is there a way to keep the sprites the size they're supposed to be?

There is no easy way (as far as I know) to resize the surface and have all the sprites resize. You could store the change in the window dimensions within the sprites, and use the scale property to resize them accordingly. I don't know why you want to do this to begin with, are you just trying to do a "zoom" type of effect?

Quote:
Also, is there a way to always keep a sprite above all other sprites, even ones created after it?

yea you could try creating different SpriteGroups like
dim ssg as SuperSpriteGroup
dim s1, s2 as SuperSprite
s1 = new SuperSprite //Sprite 1
s2 = new SuperSprite //Sprite 2
//assign images, positions etc.

ssg = new SuperSpriteGroup
ssg.append s2 //append the second sprite to the group
//you can append sprites to your hearts content.

SSSurface.sprites.append ssg
SSSurface.sprites.append s1

In that code you could create a bunch of sprites after the first, but the first sprite will still be on top. Not sure if this is what you were asking. Or if you were just looking for a way to change the drawing priority while in-game like this:
dim total as integer
total = SSSurface.Sprites.z_spriteUbound
//this example swaps the last sprite drawn to the surface with the first sprite
SSSurface.Sprites.Swap(0,total)//(the index of sprite A, the index of sprite B)

If that went with the above example then s1 would swap places with ssg in the drawing order.

Hope that helps :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Thu Nov 13, 2008 12:02 am 
Offline
User avatar

Joined: Sun Mar 23, 2008 3:30 pm
Posts: 163
tcIgnatius wrote:
Quote:
Is there a way to keep the sprites the size they're supposed to be?

There is no easy way (as far as I know) to resize the surface and have all the sprites resize. You could store the change in the window dimensions within the sprites, and use the scale property to resize them accordingly. I don't know why you want to do this to begin with, are you just trying to do a "zoom" type of effect?


I want the user to be able to resize the window (or make it full screen) and have the sprite surface to resize with it.

And it's not a matter of the scale property - if a window is resized horizontally but not vertically it also distorts the aspect ratio (pretty badly I might add).

Surely I'm not the first developer to ever want to make a full-screen game. I'm not sure how else to make it full-screen and still work properly since lots of people have lots of different resolutions, and when I'm working on the project in the REALbasic IDE I'm not working with objects that are 1920 x 1200 pixels in size.


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Thu Nov 13, 2008 2:21 am 
Offline

Joined: Tue Sep 09, 2008 1:43 am
Posts: 39
Quote:
Surely I'm not the first developer to ever want to make a full-screen game.

Ok, so I understand what you're saying. If you want the game to have different resolutions then you should have that option before the surface runs. I'd use another window as the background, with the window the surface is in centered on the screen. I originally thought you were saying the user would be able to drag and resize the window as the game's running, which didn't make sense.

however, to my knowledge there is no easy way to display sprites that were made for a 640x480 screen to appear on a 1680x1050 without distortion, nor have I ever seen a game accomplish this.


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Thu Nov 13, 2008 10:11 am 
Offline
User avatar

Joined: Sun Mar 23, 2008 3:30 pm
Posts: 163
OK, so what I've done based on your advice was made the full-screen window and sprite surface appear first, then reset it, then place the sprites then run it again. Thanks


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Fri Jan 09, 2009 4:48 pm 
Offline
User avatar

Joined: Sun Mar 23, 2008 3:30 pm
Posts: 163
tcIgnatius wrote:
Quote:
Also, is there a way to always keep a sprite above all other sprites, even ones created after it?

yea you could try creating different SpriteGroups like
dim ssg as SuperSpriteGroup
dim s1, s2 as SuperSprite
s1 = new SuperSprite //Sprite 1
s2 = new SuperSprite //Sprite 2
//assign images, positions etc.

ssg = new SuperSpriteGroup
ssg.append s2 //append the second sprite to the group
//you can append sprites to your hearts content.

SSSurface.sprites.append ssg
SSSurface.sprites.append s1

In that code you could create a bunch of sprites after the first, but the first sprite will still be on top. Not sure if this is what you were asking.


I tried this, appending a sprite to a group, then appending the group to the Surface. Later on, when a user presses a button, a new sprite is (by itself) appended to the Surface, but it still appears on top of the group.


Top
 Profile  
Reply with quote  
 Post subject: Re: Some SuperSpriteSurface 2 Beta 2 Questions
PostPosted: Fri Jan 09, 2009 5:35 pm 
Offline

Joined: Tue Sep 09, 2008 1:43 am
Posts: 39
Quote:
a new sprite is (by itself) appended to the Surface, but it still appears on top of the group.


You have to append to the group. The group will then update the surface.

in the nextframe of the surface for example:
Dim newSpriteObject as SuperSprite
//Create an instance
//Set the properties
if then 'some condition
SuperSpriteGroup(me.Sprites.Item( Sprite_ID ).Append newSpriteObject
End if


if Sprite_ID is 0 then it was the first sprite created. Anything appended to this object will appear behind objects with an ID > 0.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group