-
Notifications
You must be signed in to change notification settings - Fork 8
/
main.go
63 lines (55 loc) · 1.71 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
// Copyright 2016 Garrett D'Amore
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License.
// You may obtain a copy of the license at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"flag"
"fmt"
"io/ioutil"
"log"
"math/rand"
"os"
"time"
)
const Version = "0.2"
// Proxima (Escape from Promixa 5) is a text-oriented game, utilizing
// Unicode characters and text terminal display capabilties, demonstrating
// the capabilities of tcell. It needs at least an 80x24 column terminal
// to run well, and the highest baud rade you can arrange.
func main() {
var logfile string
flag.StringVar(&logfile, "log", logfile, "Log file for debugging log")
flag.Parse()
rand.Seed(time.Now().UnixNano())
if logfile != "" {
if f, e := os.Create(logfile); e == nil {
log.SetOutput(f)
}
} else {
log.SetOutput(ioutil.Discard)
}
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("Escape from Proxima 5, %s\n", Version)
fmt.Printf("Copyright 2016 Garrett D'Amore\n")
fmt.Printf("Licensed under the Apache 2 license.\n")
fmt.Printf("See http://www.apache.org/licenses/LICENSE-2.0\n")
fmt.Printf("Thanks for playing!\n")
}