__arcade_score=0
clear_screen() {
+ # first reset then clear
+ echo -en '\033c'
echo -en '\033[2J'
}
+echo_off() {
+ stty -echo
+}
+
+echo_on() {
+ stty echo
+}
+
+hide_cursor() {
+ tput civis
+}
+
+show_cursor() {
+ tput cvvid
+}
+
move_cursor() {
local x=$1
local y=$2
esac
}
-hide_cursor() {
- echo -en '\033[25l'
-}
-
-show_cursor() {
- echo -en '\033[25h'
-}
-
draw_score_board() {
local value=${1:-0}
local scoreboard_y=20
arcade_screen_init() {
clear_screen
+ echo_off
hide_cursor
draw_score_board
}
arcade_screen_finish() {
move_cursor 0 23
show_cursor
- echo high score: $__arcade_score
+ echo_on
}
arcade_screen() {
local -A blocks
# first, clear the screen and hide the cursor
- clear_screen
- hide_cursor
-
- draw_score_board
+ arcade_screen_init
while read x; do
read y