move: bouncing ball

This commit is contained in:
Inanc Gumus
2019-03-14 20:12:43 +03:00
parent 6576f83d16
commit 9b096998fb
5 changed files with 2 additions and 7 deletions

View File

@ -9,11 +9,9 @@ package main
import (
"fmt"
"os"
"time"
"github.com/inancgumus/screen"
"golang.org/x/crypto/ssh/terminal"
)
func main() {
@ -26,12 +24,9 @@ func main() {
)
// get the width and height of the terminal dynamically ***
width, height, err := terminal.GetSize(int(os.Stdout.Fd()))
if err != nil {
fmt.Println("cannot get width and height", err)
return
}
width, height := screen.Size()
width /= 2 // our emoji is 2 chars wide
height-- // for the border
var (
px, py int // ball position