13
I've created a function that creates a word wrapped sprite based on screen resolution basically so a standard font can be used (resizing a font doesn't work 100% on my screen scaling code).
This works fine for PC and iOS but on WebOS it is having problems. If I use the function twice (two different sets of text) then neither sprite will show anything. Once and it works fine. If I pass in a screen number for createscreen and make the second use of the function a different createscreen number then it also works fine on WebOS. But why?
Here is the function:-
FUNCTION printsprite:pstext$,psfont%
LOCAL sentence$[],word$,fontw%,fonth%
SETFONT psfont
GETFONTSIZE fontw,fonth
pstext$=pstext$+" "
WHILE pstext$<>""
word$=pstext$
WHILE LEN(word$,1)>targetx OR RIGHT$(word$,1)<>" "
word$=LEFT$(word$,LEN(word$)-1)
WEND
DIMPUSH sentence$[],TRIM$(word$)
pstext$=LTRIM$(MID$(pstext$,LEN(word$)))
WEND
LOCAL pssprite%=GENSPRITE()
CREATESCREEN 9,pssprite,targetx,fonth*LEN(sentence$)
USESCREEN 9
LOCAL itemno=0
FOREACH item$ IN sentence$[]
PRINT item$,(targetx/2)-(LEN(item$,1)/2),fonth*itemno,1
INC itemno
NEXT
USESCREEN -1
RETURN pssprite
ENDFUNCTION
Note that this is in a different file to the main code being called from a function. Also in another file to the main code I use a similar technique and that works with no problem in WebOS. This though works with the createsreen one after another with no function to make things easier. Here is the code from that function:-
LOCAL shoptext%,shopchar$,shoptext2%,shopchar2$,shoptext3%,shopchar3$,shoptext4%,shopchar4$
IF info=0
shoptext%=GENSPRITE()
shopchar$="Accessing Shop"
CREATESCREEN 9,shoptext,targetx,shopfonth
USESCREEN 9
SETFONT shoptitlefont
PRINT shopchar$,0,0,1
USESCREEN -1
shoptext2%=GENSPRITE()
shopchar2$="Please wait..."
CREATESCREEN 9,shoptext2,targetx,shopfonth
USESCREEN 9
SETFONT shopfont
PRINT shopchar2$,0,0,1
USESCREEN -1
shoptext3%=GENSPRITE()
shopchar3$="Accessing Web"
CREATESCREEN 9,shoptext3,targetx,shopfonth
USESCREEN 9
SETFONT shoptitlefont
PRINT shopchar3$,0,0,1
USESCREEN -1
shoptext4%=GENSPRITE()
shopchar4$="Processing Info"
CREATESCREEN 9,shoptext4,targetx,shopfonth
USESCREEN 9
SETFONT shoptitlefont
PRINT shopchar4$,0,0,1
USESCREEN -1
This works perfectly on WebOS with all sprites showing fine.
Considering this all works perfectly on iOS and PC with multiple resolutions it is annoying the hell out of me. Can you see if there is a problem with the WebOS implementation Gernot?
Cheers