-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
executable file
·64 lines (54 loc) · 1.03 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package main
import (
"fmt"
"log"
"os"
)
const (
Cell = '█'
MainWidth = 30
)
// type Animation struct {
// Ticker *time.Ticker
// Duration time.Duration
// Piece *Sprite
// }
// func NewAnimation(duration time.Duration, piece *Sprite) *Animation {
// return &Animation{
// Duration: duration,
// Piece: piece,
// }
// }
// func (a *Animation) Start() {
// a.Ticker = time.NewTicker(a.Duration)
// go func() {
// for {
// select {
// case <-a.Ticker.C:
// if g.CanPieceMoveVertically(a.Piece) {
// a.Piece.PosY += 1
// } else {
// a.Ticker.Stop()
// }
// }
// }
// }()
// }
// func (a *Animation) Stop() {
// a.Ticker.Stop()
// }
func main() {
if f, e := os.Create("debug.log"); e == nil {
log.SetOutput(f)
}
game := &Game{}
if err := game.Init(); err != nil {
fmt.Printf("Failed to initialize game: %v\n", err)
os.Exit(1)
}
if err := game.Run(); err != nil {
fmt.Printf("Failed to run game: %v\n", err)
os.Exit(1)
}
fmt.Printf("Thanks for playing!\n")
}