V9 print bug

Previous topic - Next topic

Crivens

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.
Code (glbasic) Select
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
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

Are you sure that the two bits of text aren't overprinting each other ?

Crivens

Not at all. Repeating the print command twice makes it work which is weird. So if you take the above code but on the first print do this:-
Code (glbasic) Select
PRINT textstr$,screenx/2-(LEN(textstr$,kern)/2),screeny-fonty+5,kern
PRINT textstr$,screenx/2-(LEN(textstr$,kern)/2),screeny-fonty+5,kern


Then it works just fine. Plus my PC upstairs is still using V8, and both the "GAMENAME" print line, and the mytime$ print line shows perfectly fine with the exact same code as in the first post.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

Take out the second SETFONT command - see if thats the cause...

Crivens

I took out the second duplicate GAMENAME print line and // out the second SETFONT and it's the same as before. For some reason only duplicating the GAMENAME print line on 2 lines (1 after the other) makes it print it.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

Can you try this :

Code (glbasic) Select
PRINT "Hello",100,100
PRINT "Hello",100,116
SHOWSCREEN
KEYWAIT


If that works (and it should), then there is either a problem with the font used or the coordinates are not in range of the screen

Crivens

Yes, it works, but then everything else with print seems to work fine as it did before. It's just this routine.

If it is a font issue, then how come using the exact same code and fonts on v8 causes both text prints to be shown fine? The same font is used for other prints elsewhere with no issue in v8 or v9. It's just this one place that I can see doesn't print the text in v9. Plus, as I said, repeating the exact same code line on the next line causes the printed text to be shown no problems, as it should have been from the single print line. Really doesn't sound right.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Crivens

Just on the off chance that I had made some kind of weird error by accident when I copied this over to the laptop (and upgraded to v9) I then copied the project back up to my desktop PC which is running v8. I then remmed out the 2nd duplicated text line (ie. the exact same print code line underneath the first print) and ran on the desktop. All the text shows fine again. This same code will miss out the GAMENAME print line if it is only used once on the laptop using v9. I'll upgrade the desktop to v9 tomorrow and see if the same problem happens.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

If is does, make the fonts available and I'll get a short test program done

Crivens

Ooh, interesting. I just updated the desktop (AMD with Nvidia) to v9 and it prints just fine with exactly the same code (ie. only one print line rather than duplicating like I did on the laptop). Maybe the laptop (Intel with ATI) never worked before v9 either. Come to think of it I did notice that CREATESCREEN didn't work at all on the laptop when I used it for my first fade routine. Is a still a funny bug on the laptop though, and I really need it to work the same. Do you think perhaps the video drivers need updating on the laptop, or is there a known problem with ATI drivers (older ATI 9600 Turbo I believe on the laptop)?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

MrTAToad

As the 9600 Turbo is very old, the drivers probably wouldn't have be updated in a very long time, so probably wouldn't be able to handle everything that Gernot has crammed into GLBasic

Crivens

Fair enough but it is still a weird bug (with a weirder solution). Especially considering all other text looks fine.

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.