TV_Terminal_Demo; How can I use graphics.spin?
Hi,
I have just started dealing with the spin language.
I want to·make some simple modifications·of the·tv_terminal_demo, so that I can draw a line (or something else) using the·graphics.spin object.·Therefore I·added·some test-code to the tv_terminal.spin object like:
PUB test(x_value, y_value)
····· gr.color(2)··········································· ' color changes -> OK
····· gr.width(3)·········································· ' width changes -> OK
····· gr.plot(x_value,y_value)·························' no output on the display??????
····· gr.line(x_value+30,y_value+30)··············' no output????
····· gr.text(120,120,string("Hello"))··············· ' no output????
····· dec(x_value)·········································' -> OK
Using this code I can change for example the color, but I can't use gr.plot(), gr.line() and·gr.text() the way I want to.
So, where is my mistake? How can I use all methods of the graphics.spin object in the tv_terminal_demo?
I have just started dealing with the spin language.
I want to·make some simple modifications·of the·tv_terminal_demo, so that I can draw a line (or something else) using the·graphics.spin object.·Therefore I·added·some test-code to the tv_terminal.spin object like:
PUB test(x_value, y_value)
····· gr.color(2)··········································· ' color changes -> OK
····· gr.width(3)·········································· ' width changes -> OK
····· gr.plot(x_value,y_value)·························' no output on the display??????
····· gr.line(x_value+30,y_value+30)··············' no output????
····· gr.text(120,120,string("Hello"))··············· ' no output????
····· dec(x_value)·········································' -> OK
Using this code I can change for example the color, but I can't use gr.plot(), gr.line() and·gr.text() the way I want to.
So, where is my mistake? How can I use all methods of the graphics.spin object in the tv_terminal_demo?
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
StampPlot - GUI and Plotting, and XBee Wireless Adapters
Southern Illinois University Carbondale, Electronic Systems Technologies
Post Edited (Martin Hebel) : 3/20/2007 12:33:48 PM GMT
Here is an example one, with the mouse left working, and some of the original variables left defined:
Essentially, you need the loop that clears the drawing screen, runs your commands, copies them to the display screen, then starts over. Without that, you won't see anything with these graphics objects. They are double buffered.
It seems to me, you are putting your graphics commands in the wrong place too. The graphics.spin contains the primitives you need to draw lines, etc... the tv.spin actually drives the video, and another program will wrap that together to form a whole that displays stuff on your screen.
Check out the graphics_demo.spin. I've stripped it down here, so you can just add the commands you want to explore and run it with your copy of the prop tool. In the OBJ section, you see mouse, tv and graphics defined to point to their respective spin program blocks. This is what you want to do with your sample graphics programs. Since nearly the entire works is software, there are a number of parameters to be managed. That's why stripping down one of the demos is a great place to start!
If a copy - paste from the forum does not work, just edit your graphics_demo.spin to look similar to the one I posted here, and go for it. Worst case, remove one command at a time, until you have just the empty screen running!
Post Edited (potatohead) : 3/20/2007 1:46:41 PM GMT
It was problem concerning the scaling and the point of origin's location. It's solved now.
The example codes are very helpful!