One more command for Sprites

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

One more command for Sprites

Post by va!n »

I have requested this, very long ago... what do you think about something like:

HandleSprite(SpriteID,X,Y)
MidHandleSprite(SpriteID)

So your sprites are not ever handled at 0,0 !! Changing the Handle would be nice for some stuff like rotating around the centre (MidHandle) of a Sprite or Image!
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Fou-Lu
Enthusiast
Enthusiast
Posts: 201
Joined: Tue Jul 12, 2005 8:30 am
Location: I'm pretty sure this is all a nightmare
Contact:

Post by Fou-Lu »

I don't think it's absolutely necessary, but it would be good. I've already seen that in darkbasic, it was called spriteoffset. When you say SpriteID, you mean the number of the sprite, right?

~Fou-Lu (aka Lørd Cinneris (actually Elias Sant'Ana))

Image Image
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

Fou-Lu wrote:I don't think it's absolutely necessary, but it would be good. I've already seen that in darkbasic, it was called spriteoffset. When you say SpriteID, you mean the number of the sprite, right?

yes, SpriteID should be SpriteNumber ;)
I think a command like this would be very usefull, even if you have a sprite object with a size of 80x80 for example and want rotate it around position 40,40 instead at 0,0! :wink:
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
Blade
Enthusiast
Enthusiast
Posts: 362
Joined: Wed Aug 06, 2003 2:49 pm
Location: Venice - Italy, Japan when possible.
Contact:

Post by Blade »

RotateSprite3D() rotates on the center of the sprite, not 0,0.

I want the Handle feature would be nice too :)
User avatar
Fou-Lu
Enthusiast
Enthusiast
Posts: 201
Joined: Tue Jul 12, 2005 8:30 am
Location: I'm pretty sure this is all a nightmare
Contact:

Post by Fou-Lu »

TransformSprite3D() can change the handle of a sprite3D.You could create a procedure to rotate a sprite3D in the middle:

Code: Select all

initsprite()
initsprite3d()
initmouse()

openscreen(640,480,32,"")

Procedure Mid_Rotate_Sprite3D(sprite.l,angle.f,size.f)
x1=cos(angle-2.3561944)*size*0.707106
y1=sin(angle-2.3561944)*size*0.707106
x2=-y1
y2=x1
x3=-x1
y3=-y1
x4=-x2
y4=-y2
TransformSprite3D(sprite,x1,y1,x2,y2,x3,y3,x4,y4)
endprocedure

createsprite(1,64,64,#pb_sprite_texture)
startdrawing(spriteoutput(1))
for gy=0 to 63
for gx=0 to 63
plot(gx,gy,gx*4+(gy*4<<16))
next gx
next gy
stopdrawing()

createsprite3d(1,1)

repeat
rot.f=rot+0.1
clearscreen(0,0,0)
start3d()
mid_rotate_sprite3d(1,rot,64)
displaysprite3d(1,mousex(),mousey(),255)
stop3d()
flipbuffers()
examinemouse()
until mousebutton(1)
Is this what you want?

Anyway, I think there could be a feature like that.

~Fou-Lu (aka Lørd Cinneris (actually Elias Sant'Ana))

Image Image
va!n
Addict
Addict
Posts: 1104
Joined: Wed Apr 20, 2005 12:48 pm

Post by va!n »

Fou-Lu wrote:TransformSprite3D() can change the handle of a sprite3D.You could create a procedure to rotate a sprite3D in the middle:
Is this what you want?

Anyway, I think there could be a feature like that.
yes,thats what i mean! didnt noticed that it still exist! thanks ;)
va!n aka Thorsten

Intel i7-980X Extreme Edition, 12 GB DDR3, Radeon 5870 2GB, Windows7 x64,
User avatar
Fou-Lu
Enthusiast
Enthusiast
Posts: 201
Joined: Tue Jul 12, 2005 8:30 am
Location: I'm pretty sure this is all a nightmare
Contact:

Post by Fou-Lu »

Ah, you're welcome. :oops:

~Fou-Lu (aka Lørd Cinneris (actually Elias Sant'Ana))

Image Image
Post Reply