IPhone: Does GRABSPRITE work for you?

Previous topic - Next topic

MikeHart

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

Uncle

Hi Mike,

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

Cheers,


Unc

MikeHart

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

Uncle

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.



MikeHart

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.

MikeHart

Andrew, you said you compiled for SDK 2.2.1, but your machine is a 3.0 based IPod touch , right?

Uncle

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?

MikeHart

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. :(

MikeHart


Uncle

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.

MikeHart

Hi Andrew, check your email please, I think I found what is wrong. Please test and let me know.

MikeHart

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.


MikeHart

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:

MrTAToad

Dont forget to make a bug report!

MikeHart

#14
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.