#!/usr/bin/ruby
def ansi_clear
#Clears the screen, and moves cursor to top left
printf "\e[2J"
ansi_locate 1, 1
end
def ansi_locate(row,col)
#Moves to cursor to specified row and column
printf "\e[%d;%dH", row, col
end
def ansi_hidecursor(h=true)
#Hides cursor if h, or else shows it again
if h
printf "\e[?25l"
else
printf "\e[?25h"
end
end
def ansi_setmode(modes)
#Sets dispaly modes. Modes is a string of ; seperated modes.
#List of modes over here: https://secure.wikimedia.org/wikipedia/en/wiki/ANSI_escape_code#Codes
printf "\e[%sm", modes
end |