 #compact 
 % Title "ConsoleG Demo:  Move text with mouse and arrow keys etc"

 '% WindowStyle WS_OVERLAPPEDWINDOW
 '% Animated
 '% ScaleUp
  % PlaceCentral
  % AnchorCentral

  % shaders

  $filename "t.exe"
 'uses RTL64
  uses consoleG
 
  'Keys: Esc, arrow-keys, n,m, F4

  BeginScript

  sub main
  ========

  'WaitForEvent '0 off 1 on (default on)
  static int  z, y, x
  static quad t1,t2
  if opening then 'FIRST CALL ONLY
    timemark t1
    picked=100
    'mbox "helo"
  end if
  '
  if closing then 'FINAL CALL BEFORE SHUTDOWN
    'mbox "Bye!"
    'exit sub
  end if
  cls
  pushstate
  color 1,.5,0,1
  UserMovement m1,100 'identity in steps of 100
  scale 2, 3
  print "Hello "
  popstate
  move 5

  pushstate
  color 1,1,0,1
  UserMovement m2,200
  scale 4
  print "World"
  popstate

  if not pick then
    if key[49] then picked=100 'keypress '1'
    if key[50] then picked=200 'kypress  '2'
    pushstate
    move -20,12
    static sys tally
    timemark t2
    scale 1.0
    '
    macro pr(a,b) 'PRINTING LIST
      pushstate : color .5,1,1 : print a : popstate
      pushstate : color 1,1,.5 : move 8 : print b : popstate
      printl ""
    end macro
    '
   'pr "Action Code:   ", str(act)
    pr "Picked ID:     ", str(picked)
    pr "Keyboard Code: ", str(keyd)
    popstate
  end if

  end sub 'main

  EndScript