54
I've found a strange bug with text since installing v9. Basically the following code used to work fine in v8 but now with V9 only the second print command works, with the first one completely missing (GAMENAME text). I've put in debugging and it gets to the line with the correct parameters.
IF youhavewon=0
SETFONT 1
textstr$="GAMENAME"
PRINT textstr$,screenx/2-(LEN(textstr$,kern)/2),screeny-fonty+5,kern
IF lastbatt=-1 OR GETTIMERALL()-lastbatt>10000
lastbatt=GETTIMERALL()
//mybatt%=MIN(100,MAX(0,INTEGER(PLATFORMINFO$("BATTERY")))) //Doesn't seem to work on iPhone currently (get 3% lower or so)
mytime$=PLATFORMINFO$("TIME")
mytime$=MID$(mytime$,11,2)+":"+MID$(mytime$,14,2)
ENDIF
SETFONT 2
//textstr$=mybatt%+"%"
//PRINT textstr$,screenx-LEN(textstr$,kern2),screeny-fonty2,kern2
textstr$=mytime$
PRINT textstr$,0,screeny-fonty2,kern2
IF multiplayer=1 THEN PRINT moveinfo$,0,0
ENDIF
Now the stranger bit. I noticed that if I moved the GAMENAME 3 lines of code (SETFONT to the PRINT line) to after the IF then it prints that, but not the text inside the IF (ie. the time).
And an even stranger bit. If I take the "PRINT textstr$,screenx/2-(LEN(textstr$,kern)/2),screeny-fonty+5,kern" line, that is for the "GAMENAME" text, and copy it immediately below the existing command (ie. two identical PRINT commands one line after the other), then it works just fine, with both text appearing. So perhaps a new bug that means the first print in a subroutine (this is in a subroutine in a separate gbas file) does not print? Something is up that's for sure.
Cheers