45 lines
878 B
Plaintext
45 lines
878 B
Plaintext
_window = 1
|
|
_w = 80 : _h = 24
|
|
window _window,@"Cursor Movement",fn cgrectmake(0,0,640,380)
|
|
text @"Menlo", 13
|
|
|
|
local fn LocateCursor(x as short,y as short,Character as CFStringRef)
|
|
print @(x,y) Character;
|
|
end fn
|
|
|
|
// width is 80 characters
|
|
// height is 24 rows
|
|
|
|
|
|
short x,y
|
|
|
|
// place cursor in the center to start
|
|
x = _w/2 : y = _h/2
|
|
print @(x,y) @" ";
|
|
// Move cursor up one line
|
|
y = y -1
|
|
fn LocateCursor(x,y,@"U")
|
|
// Move cursor left
|
|
x = x - 1
|
|
fn LocateCursor(x,y,@"L")
|
|
// Move cursor down
|
|
y = y + 1
|
|
fn LocateCursor(x,y,@"D")
|
|
// Move cursor right
|
|
x = x + 1
|
|
fn LocateCursor(x,y,@"R")
|
|
// Move cursor to beginning of line
|
|
x = 1
|
|
fn LocateCursor(x,y,@"S")
|
|
// Move cursor to end of line
|
|
x = _w
|
|
fn LocateCursor(x,y,@"E")
|
|
// Move cursor to top left corner
|
|
x = 1: y = 1
|
|
fn LocateCursor(x,y,@"T")
|
|
// Move cursor to bottom right corner
|
|
x = _W: y = _h
|
|
fn LocateCursor(x,y,@"B")
|
|
|
|
handleevents
|