GLBasic forum

Main forum => GLBasic - en => Topic started by: MikeHart on 2009-Aug-29

Title: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Hi folks,

if you develop for the IPhone with SDK 3.0 or 3.1 beta, does GRABSPRITE work for you? I am compiling for the SDK 2.2.1 and there it does nothing.

Cheers
Michael
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Uncle on 2009-Aug-29
Hi Mike,

I havent used that command yet.  if you have a quick demo I can compile it for you and check.

Cheers,


Unc
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Hi Andrew,

thanks I appreciate that:

Code (glbasic) Select


SETCURRENTDIR("Media")

CONSTANT sprTest% = 1
CONSTANT sprNew% = 2

LOADSPRITE "yoursprite.png",sprTest%
DRAWSPRITE sprTest%,0,0

GRABSPRITE sprNew%,0,0,32,32
BLACKSCREEN

draw_screen()
END

FUNCTION draw_screen:
WHILE TRUE
DRAWSPRITE sprNew%,240-32,160-32
SHOWSCREEN
WEND
ENDFUNCTION



Nothing special, just put a PNG sprite inside the media folder and change the filename for LOADSPRITE.

Thanks
Michael
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Uncle on 2009-Aug-29
Ok, I tested it with 3.0 and 2.2.1 and both worked fine.  The only things I can think it can be are...

1.Media isn't in the Media folder in the XCode directory
2.There is a problem with the filename... file names are case sensitive.  It will run on a PC, but when running on a mac it can fail if the filename doesnt match 100%
3 Not sure, but perhaps you are grabbing past the dimensions of the image.


Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Ok, then it must be some else, because when I just DRAWSPRITE the image that is the base for GRABSPRITE, then this works fine. Maybe it is the image format that GRABSPRITE doesn't like.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Andrew, you said you compiled for SDK 2.2.1, but your machine is a 3.0 based IPod touch , right?
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Uncle on 2009-Aug-29
Good question.  In Xcode you can compile using more than one SDK.  So I compiled the program using 2.2.1 SDK as well.  Did you check any of the suggestions I mentioned above?
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Yes, I did. if the the file wasn't there or the filename wrong capitalized, it wouldn't display with DRAWSPRITE either, or? but it does.

I guess I just give up. :(
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
btw. thanks for testing.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Uncle on 2009-Aug-29
Before you give up please can you test the file I just sent you.  Its a sprite test which I know runs on several machines.  I have sent the whole project file so that should resolve any filename issues.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Hi Andrew, check your email please, I think I found what is wrong. Please test and let me know.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
Thanks again Andrew for helping me securing that it is a bug in GLB and not in my code.

I never thought GLB would be able to react this way.  ;/ I allready started to question myself.  :whistle:

Edit: Also now I know how to work around that bug.

Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
And to the ones who run into the same problem in the future, GrabSprite on the IPhone doesn't work correctly, or not at all in landscape mode. In Portrait mode it is fine.

Maybe it is not surpose to work in landscape mode, who knows. Help file doesn't mention anything about it  :nana:
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MrTAToad on 2009-Aug-29
Dont forget to make a bug report!
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Aug-29
I'm sure one of Gernots mods will move it into the right forum space. But then I'm not sure if Gernot considers this a bug. My mentioned memory leak seem to not bother him at all.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Hemlos on 2009-Aug-30
HK is on vacation, and when he comes back im sure itll take some time for him to reply to everyone.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Kitty Hello on 2009-Sep-01
Oh my!
I didn't think of that. I try to fix it.

[edit]
Oh no. I'm using glRotate for the landscape mode. The grab is rotated by 90?, thus.
I *could* fix this, and I will. But you will not like it, because it will be horribly slow. Totally useless. Really, don't wait for it, you can 't even use it in a game that has 15 FPS, I think.

Instead use CREATESCREEN/USESCREEN.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: MikeHart on 2009-Sep-01
Np, take your time. It has no priority for me anymore.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: bigsofty on 2009-Sep-01
All bugs get fixed eventually, I think the memory leak is so small and not a 'show-stopper' its at the bottom of Gernots to-do list but that does not mean its ignored, it will get done.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Wampus on 2010-Sep-08
Did this ever get fixed for the iPhone? Documentation at http://www.glbasic.com/xmlhelp.php says its still unsupported.

I could really use this function right now. Its very useful for all sorts of things.
Title: Re: IPhone: Does GRABSPRITE work for you?
Post by: Kitty Hello on 2010-Sep-13
works with 8.085 or higher. I forgot to update the docs.