Display a VAR in graphics
samsn4
Posts: 49
I'm trying to do a simple interface with the PING))). There is no demo that uses the TV, so I'm trying to write one using Graphics. My problem is that I can not figure out how to display a variable.
Thanks for the help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Daniel Mueth
Thanks for the help
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Daniel Mueth

Comments
VAR byte decBuffer[noparse][[/noparse]12] PUB dec(value) | i,p '' Print a decimal number p := 0 if value < 0 -value decBuffer[noparse][[/noparse]p++] := "-" i := 1_000_000_000 repeat 10 if value => i decBuffer[noparse][[/noparse]p++] := value / i + "0" value //= i result~~ elseif result or i == 1 decBuffer[noparse][[/noparse]p++] := "0" i /= 10 decBuffer[noparse][[/noparse]p] := 0You'd call this to convert some variable into a decimal string, then use the text routine in the graphics package to draw the string (@decBuffer) on the screen where you want it.
You can also use the FloatString library to turn a floating point value into a string (after 1st converting it to a float with FloatMath):
Obj: gr : "graphics" TV : "TV" FP : "FloatMath" FS : "FloatString" Pub Main . . . gr.text(100,151,FS.FloatToString(FP.FFloat(x))) . .▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting Software
Southern Illinois University Carbondale, Electronic Systems Technologies