summary refs log blame commit diff stats
path: root/data/screensaver/clock.rb
blob: 6289c8096079d9d9347d7c12928908acecbcc78f (plain) (tree)
1
2
3
4
5
6
7
8
9
10









                                                         
def screensaver
	cleari

	str = Time.now.to_s
	s = Fm.cols - str.size
	s = 1 if s < 0

	puti((Fm.lines.to_f/2).floor, s/2, str)
#	puti(rand(Fm.lines), rand(Fm.cols), 'MEDITONSIN')
end
highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
# example program: managing the display using 'screen' objects
#
# The zero screen below means 'use the real screen'. Tests can also use fake
# screens.

recipe main [
  open-console
  print-character 0/screen, 97/a, 2/red
  1:number/raw, 2:number/raw <- cursor-position 0/screen
  wait-for-event 0/console
  clear-screen 0/screen
  move-cursor 0/screen, 0/row, 4/column
  print-character 0/screen, 98/b
  wait-for-event 0/console
  move-cursor 0/screen, 0/row, 0/column
  clear-line 0/screen
  wait-for-event 0/console
  cursor-down 0/screen
  wait-for-event 0/console
  cursor-right 0/screen
  wait-for-event 0/console
  cursor-left 0/screen
  wait-for-event 0/console
  cursor-up 0/screen
  wait-for-event 0/console
  close-console
]