GLBasic forum

Main forum => GLBasic - en => Topic started by: fjsantosb on 2009-Sep-29

Title: BlendScreen - iPhone
Post by: fjsantosb on 2009-Sep-29
Hi There!
I recently discover that behaviour of method blendscreen is not like on pc.
Its suppose its fades current buffer to a picture.
On windows works well, but on iPhone, its fades from black to a picture.
Anyone have same problem? Any solution?

Thanks in advance.

Best Regards, fjsantos.
Title: Re: BlendScreen - iPhone
Post by: Kitty Hello on 2009-Sep-29
In landscape mode, these commands do _not_ work:
BLENDSCREEN, GRABSPRITE, USEASBMP.

If I make them work one day, they will be horribly slow, so don't use them in the first place.
Title: Re: BlendScreen - iPhone
Post by: mykyl66 on 2009-Oct-02
Wish I had noticed this before as I have been using GRABSPRITE..... in landscape mode.

Back to the drawing board so to speak.

Mike R
Title: Re: BlendScreen - iPhone
Post by: mykyl66 on 2009-Oct-02
I am trying to get my head back into programming mode after many years away. WHat is the alternative to using Grabsprite in iphone code. I have a bunch of images in my graphic atlas that need to be able to be called thoughout my game.

Any help is appreciated.

Mike R
Title: Re: BlendScreen - iPhone
Post by: Ian Price on 2009-Oct-03
Do you mean a series of graphics in a tilestrip? If so, use LOADANIM and DRAWANIM.

If that's not what you meant, then erm...
Title: Re: BlendScreen - iPhone
Post by: mykyl66 on 2009-Oct-03
That's a close description except imagine its an a4 page with multiple rows and columns of graphics. Doing it this way means I can load all my graphics in one fell swoop and for a usually a much smaller memory footprint.

I just need to get my thinking cap on. :D. Too many late nights and early mornings with an 8 month old baby.

Cheers

Mike R
Title: Re: BlendScreen - iPhone
Post by: Moru on 2009-Oct-03
If you have different sizes of sprites on a big sheet, you need to make sure this sheet is the same height as width, it also has to be within some sort of reasonable size, otherwise older cards won't be able to load the texture. It might even have to be on a power of two boundary, 64, 128, 256 and so on. Or at least on an even 16 pixels or something. It might work without this on your computer but there is bound to be a grafics card that can't handle this :-)

Second thing you do is to use STARTPOLY to draw the sprites from this sheet. This will give you some troubles with doing collision detection though that I haven't worked out yet since I don't need it for my implementation :-) Rotating/scaling is possible but you have to do the calculations yourself.
Title: Re: BlendScreen - iPhone
Post by: Uncle on 2009-Oct-03
Polyvector is the way to go.  We use it in exactly the way you mention.  You will have to write your own collision stuff though but thats not too hard to do.
Title: Re: BlendScreen - iPhone
Post by: mykyl66 on 2009-Oct-03
Cheers for that folks. Its not such a problem for this current game as I can easily lock it to portrait mode but for future reference I will use Polyvector.

Thanks agin.

Mike R
Title: Re: BlendScreen - iPhone
Post by: mykyl66 on 2009-Oct-04
Is there any issue using PRINT and using my Atlas as some kind of font system but instead of letters use images. (this is in place of grabsprite) Is there some reason that would not work or cause some issues?

Cheers

Mike R
Title: Re: BlendScreen - iPhone
Post by: Ian Price on 2009-Oct-04
If you mean using a bitmap font, then that's easy and fast. Use LOADANIM to load a spritesheet of your characters, then use a function to draw them. I posted a bitmap font function and so did PeeJay.

My basic system is something like this -

Code (glbasic) Select

FUNCTION txt: x, y, ss$
LOCAL xpos=0
LOCAL i
LOCAL cr

  FOR i=0 TO LEN(ss$)-1 // Keep writing until you run out of text
   cr=(ASC(MID$(ss$,i,1))-32) // Work out the image number of the specified letter in your text (ss$)

    DRAWANIM 99,cr,x+(xpos*width),y // Draw each character of the text using anim #99

     xpos=xpos+1

  NEXT
ENDFUNCTION


Usage - txt(X,Y,text$)

Remember to use LOADANIM at the start of your program (I've used anim number 99 in this example).