How to set X and Y positions with VGA_text object ***SOLVED***
Crosswinds
Posts: 182
Hello.
Im currently using VGA_text object in my project.
And the only thing that im missing now is to move around the text "cursor" on the screen.
For example
first i print "hello" in the top left corner (thats simple)
But then i want to move the cursor so that i can print "everyone"in the bottom right corner,(or somewere else for that matter[noparse]:)[/noparse])
Thanks
Post Edited (Crosswinds) : 4/17/2010 7:41:37 PM GMT
Im currently using VGA_text object in my project.
And the only thing that im missing now is to move around the text "cursor" on the screen.
For example
first i print "hello" in the top left corner (thats simple)
But then i want to move the cursor so that i can print "everyone"in the bottom right corner,(or somewere else for that matter[noparse]:)[/noparse])
Thanks
Post Edited (Crosswinds) : 4/17/2010 7:41:37 PM GMT
Comments
Yes i have seen this, but i cant figure out how to use it actually..
it says:
$0A = set X position (X follows)
$0B = set Y position (Y follows)
But what should the syntax look like?
For example:
vga.out($0A) send $0A to it, but where, and how should i enter the X position?
So, for example, to move the cursor to row 5, column 10, for an object named vga you'd issue: vga.out($0A); vga.out(10); vga.out($0B); vga.out(5), with those instructions on four separate lines (decimal or hex can be used for the coordinates). That should (don't have a test board handy, ha) set the cursor such that the next vga.out printing instruction should take place at the set cursor position. Regarding the documentation, in that the procedure only takes one parameter/argument, you have to use a second .out instruction to send the coordinate. Again, the procudure will remember that you've sent either $0A or $0B and be expecting the actual coordinate value. Incidentally, as I recall, you can set the X- and Y-coordinates independently. That is, nothing compells you to set both at (nearly) the same time. They are set independently. If you only change one, the other will retain its value. Onward and upwards.
'display.out($0A) 'Set X
'display.out(0)
'display.out($0B) 'Set Y
'display.out(2)
That set the draw location to 0,2 so I could draw an alert. Right afterwards is a display.str(). It was commented out in favor of some constants that defined where the alert was located, along with some logic to center it.
Case solved [noparse]:)[/noparse]
I wrote this small subroutine to use it everywhere in the programm:
PUB Plot (x,y)
display.out($0A) 'Set X
display.out(x)
display.out($0B) 'Set Y
display.out(y)
Regards
Gianni