Problems regarding Font.Draw
Author |
Message |
cyaniede
|
Posted: Tue Mar 19, 2013 11:33 pm Post subject: Problems regarding Font.Draw |
|
|
What is it you are trying to achieve?
I'm trying to get my racing program working, and it mostly is. I have a bit of trouble caused by the output screen.
What is the problem you are having?
When I use Font.Draw to draw an array of a string variable, it works, but when I try to draw an array of a int variable, it doesn't work. I suspect it's because it's an int, and not a string, but I'm not sure how to fix it.
The variable is needed to keep track of a balance, and is needed to be actively displayed.
Describe what you have tried to solve this problem
Nothing. I have no idea how to solve this problem.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
var balance : array 1 .. playernum of int
var font2x : int := 699
var font1y : int := 535
for TheLab : 1 .. playernum
font1y - = 85
Font.Draw (balance (TheLab ), font2x, font1y, font1, black)
end for
|
Please specify what version of Turing you are using
I'm not sure, sorry. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Tue Mar 19, 2013 11:40 pm Post subject: RE:Problems regarding Font.Draw |
|
|
if you read the error message, it should tell you just that -- it's expecting a string. You can check the documentation of exactly what is needed for Font.Draw
The solution should be pretty obvious -- if the text argument is required to be a string, then you should supply a string, not an int.
Luckily 1 and "1" look very similar when printed. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
cyaniede
|
Posted: Tue Mar 19, 2013 11:43 pm Post subject: RE:Problems regarding Font.Draw |
|
|
But that's the problem though, because I need to output it as that int, but I still need to use it for calculations, and then output it as a new value again later.
Is there some way I could convert an int into a string and back again? |
|
|
|
|
|
Tony
|
Posted: Wed Mar 20, 2013 12:12 am Post subject: RE:Problems regarding Font.Draw |
|
|
Font.Draw only draws the string and nothing else. So you only need to convert from int -> string, not the other way.
How do you think this could be accomplished? |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|
|