Page 1 of 1

How I can grab a sprite from another?

Posted: Thu Jan 28, 2010 10:26 pm
by Lebostein
Hi,

I have a tilemap (640 x 640 pixel) with 10 x 10 tiles á 64 x 64 pixel. Now, I want to create some 3D-Sprites (64 x 64 pixel) from this map.

With Windows the only way is:

Code: Select all

UseBuffer(Tilemap)
t1 = GrabSprite(#PB_Any, 000, 000, 64, 64, #PB_Sprite_Texture)
t2 = GrabSprite(#PB_Any, 128, 064, 64, 64, #PB_Sprite_Texture)
....
UseBuffer(#PB_Default)
How can I do this with Mac??

Don't work: ClipSprite + CopySprite generates a duplicate from source without clipping... :cry:

Re: How I can grab a sprite from another?

Posted: Thu Jan 28, 2010 10:40 pm
by jamirokwai
Lebostein wrote:Hi,

I have a tilemap (640 x 640 pixel) with 10 x 10 tiles á 64 x 64 pixel. Now, I want to create some 3D-Sprites (64 x 64 pixel) from this map.

With Windows the only way is:

Code: Select all

UseBuffer(Tilemap)
t1 = GrabSprite(#PB_Any, 000, 000, 64, 64, #PB_Sprite_Texture)
t2 = GrabSprite(#PB_Any, 128, 064, 64, 64, #PB_Sprite_Texture)
....
UseBuffer(#PB_Default)
How can I do this with Mac??
Did you try Startdrawing(SpriteOutput(0)); and then GrabSprite(#PB_Any, 0, 0, SpriteWidth(0), SpriteHeight(0)) ?
Can test it atm. Just an idea.

Re: How I can grab a sprite from another?

Posted: Fri Jan 29, 2010 11:23 am
by Lebostein
The help says:
"Note: GrabSprite() should be always called outside a StartDrawing() : StopDrawing() block."
Not good idea :(

Other ideas, hints?

Re: How I can grab a sprite from another?

Posted: Wed Feb 17, 2010 11:41 am
by jamirokwai
For me, this works:

http://www.purebasic.fr/english/viewtop ... 25#p316127

It's similar to your question. Just Display the sprite instead of the DrawText.

EDIT:
Hey, Rook.
I get the same error-message now. Can't remember, what I linked here... Sorry.
Possibly, it's this: http://www.purebasic.fr/english/viewtop ... 24&t=42815

Re: How I can grab a sprite from another?

Posted: Mon Aug 23, 2010 9:48 pm
by Rook Zimbabwe
OK I clicked the link above and was told that I AM NOT AUTHORIZED TO VIEW THIS FORUM???

Re: How I can grab a sprite from another?

Posted: Mon Aug 23, 2010 11:19 pm
by jamirokwai
Rook Zimbabwe wrote:OK I clicked the link above and was told that I AM NOT AUTHORIZED TO VIEW THIS FORUM???
Hey Rook,
edited my post above your post...