Computer Science Canada

Displaying variables with Font.Draw

Author:  vertozia [ Sat Jan 20, 2007 5:42 pm ]
Post subject:  Displaying variables with Font.Draw

Hey there, I'm trying to make a scoring system, but i want to make the score bigger, there is a problem

correct is my score variable and is equal to 0, with each correct answer it increases by one. When i want to see the score it gives me an error that i do not know how to correct this (argument is the wrong type. please have a look at my code. I tried defining font . draw with a variable then trying to execute it instead of executing it on the spot, it still didn't work.



Posted Image, might have been reduced in size. Click Image to view fullscreen.

Author:  neufelni [ Sat Jan 20, 2007 6:19 pm ]
Post subject:  RE:Displaying variables with Font.Draw

The problem is that your score is an int variable and Font.Draw takes a string as an argument. To solve this problem you just need to convert your int to a string. This is done using intstr:
Turing:

var score : int := 5
var font : int := Font.New("Arial:12")

Font.Draw(intstr(score), 10, 10, font, 7)

Author:  CodeMonkey2000 [ Sat Jan 20, 2007 6:20 pm ]
Post subject:  RE:Displaying variables with Font.Draw

use intstr(correct)

Author:  vertozia [ Sat Jan 20, 2007 8:51 pm ]
Post subject:  RE:Displaying variables with Font.Draw

cool, thanks a lot, gave you both some random bits.


: