How I can grab a sprite from another?

Mac OSX specific forum
Lebostein
Addict
Addict
Posts: 849
Joined: Fri Jun 11, 2004 7:07 am

How I can grab a sprite from another?

Post 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:
jamirokwai
Enthusiast
Enthusiast
Posts: 799
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: How I can grab a sprite from another?

Post 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.
Regards,
JamiroKwai
Lebostein
Addict
Addict
Posts: 849
Joined: Fri Jun 11, 2004 7:07 am

Re: How I can grab a sprite from another?

Post by Lebostein »

The help says:
"Note: GrabSprite() should be always called outside a StartDrawing() : StopDrawing() block."
Not good idea :(

Other ideas, hints?
jamirokwai
Enthusiast
Enthusiast
Posts: 799
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: How I can grab a sprite from another?

Post 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
Last edited by jamirokwai on Mon Aug 23, 2010 11:18 pm, edited 1 time in total.
Regards,
JamiroKwai
User avatar
Rook Zimbabwe
Addict
Addict
Posts: 4322
Joined: Tue Jan 02, 2007 8:16 pm
Location: Cypress TX
Contact:

Re: How I can grab a sprite from another?

Post by Rook Zimbabwe »

OK I clicked the link above and was told that I AM NOT AUTHORIZED TO VIEW THIS FORUM???
Binarily speaking... it takes 10 to Tango!!!

Image
http://www.bluemesapc.com/
jamirokwai
Enthusiast
Enthusiast
Posts: 799
Joined: Tue May 20, 2008 2:12 am
Location: Cologne, Germany
Contact:

Re: How I can grab a sprite from another?

Post 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...
Regards,
JamiroKwai
Post Reply