-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
44 lines (35 loc) · 796 Bytes
/
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
package main
import (
"log"
"math/rand"
"time"
"github.com/mlvhub/pongbiten/pongbiten/assets"
"github.com/mlvhub/pongbiten/pongbiten/game"
"github.com/hajimehoshi/ebiten/v2"
)
const (
title = "Pongbiten"
width = 1200
height = 600
)
func main() {
// pseudo-randomness
rand.Seed(time.Now().UnixNano())
// window config
ebiten.SetWindowTitle(title)
ebiten.SetWindowSize(width, height)
// create and load assets
assets, err := assets.New()
if err != nil {
log.Fatalf("failed to create and load assets: %v", err)
}
// create a new game
game, err := game.New(width, height, title, assets)
if err != nil {
log.Fatalf("failed creating a new game: %v", err)
}
// run the game
if err := ebiten.RunGame(game); err != nil {
log.Fatalf("failed running the game")
}
}