-
Notifications
You must be signed in to change notification settings - Fork 1
/
intro.go
45 lines (42 loc) · 996 Bytes
/
intro.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
package main
import (
"bufio"
"fmt"
"os"
"strings"
"github.com/Fefek12/tick/Server"
)
func intro() {
PrintTitle()
buffReader := bufio.NewReader(os.Stdin)
fmt.Print("Join or Host: ")
response, _ := buffReader.ReadString('\n')
res := strings.ToLower(strings.TrimSpace(response))
switch res {
case "join":
fmt.Print("Enter Port under LocalHost to Join: ")
joinAddr, _ := buffReader.ReadString('\n')
joinAddr = strings.TrimSpace(joinAddr)
loading_screen(joinAddr)
c, err := NewClient(joinAddr)
if err != nil {
panic(err)
}
for {
c.Render()
buffReader := bufio.NewReader(os.Stdin)
fmt.Println("Enter X or O and Cords")
res, err := buffReader.ReadString('\n')
if err != nil {
fmt.Println("Error Processing Input")
}
go c.SendDelta(res)
}
case "host":
fmt.Print("Enter Port under LocalHost to Host: ")
hostAddr, _ := buffReader.ReadString('\n')
hostAddr = strings.TrimSpace(hostAddr)
s := Server.NewServer(hostAddr)
s.Start()
}
}