Browse Source

Initial commit

main
Trevor Slocum 1 month ago
commit
04cd31484f
  1. 28
      README.md
  2. 21
      flags.go
  3. 15
      flags_web.go
  4. 20
      go.mod
  5. 81
      go.sum
  6. 255
      main.go

28
README.md

@ -0,0 +1,28 @@
# Brown Box Earth Simulator
[![Donate](https://img.shields.io/liberapay/receives/rocketnine.space.svg?logo=liberapay)](https://liberapay.com/rocketnine.space)
TODO
## Play
**Note:** This game is in early development. There is no real gameplay yet.
### Compile
**Note:** You will need to install the dependencies listed for [your platform](https://github.com/hajimehoshi/ebiten/blob/main/README.md#platforms).
Run the following command to build a `brownboxearthsim` executable:
`go install code.rocketnine.space/tslocum/brownboxearthsim@latest`
Run `~/go/bin/brownboxearthsim` to play.
## Support
Please share issues and suggestions [here](https://code.rocketnine.space/tslocum/brownboxearthsim/issues).
## Dependencies
- [ebiten](https://github.com/hajimehoshi/ebiten) - Game engine
- [tetra3d](https://github.com/solarlune/tetra3d) - 3D engine
- [gohan](https://code.rocketnine.space/tslocum/gohan) - Entity Component System framework

21
flags.go

@ -0,0 +1,21 @@
//go:build !js || !wasm
// +build !js !wasm
package main
import (
"flag"
"github.com/hajimehoshi/ebiten/v2"
)
func parseFlags(g *Game) {
var fullscreen bool
flag.BoolVar(&fullscreen, "fullscreen", false, "run in fullscreen mode")
flag.BoolVar(&g.NativeResolution, "native", false, "display at native resolution (default: 320x240)")
flag.Parse()
if fullscreen {
ebiten.SetFullscreen(true)
}
}

15
flags_web.go

@ -0,0 +1,15 @@
//go:build js && wasm
// +build js,wasm
package main
import (
"github.com/hajimehoshi/ebiten/v2"
)
func parseFlags() {
//world.World.DisableEsc = true
// TODO
ebiten.SetFullscreen(true)
}

20
go.mod

@ -0,0 +1,20 @@
module code.rocketnine.space/tslocum/brownboxearthsim
go 1.17
require (
github.com/hajimehoshi/ebiten/v2 v2.2.3
github.com/kvartborg/vector v0.1.0
github.com/solarlune/tetra3d v0.4.2-0.20211213223149-14b690639b14
)
require (
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be // indirect
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 // indirect
github.com/qmuntal/gltf v0.20.3 // indirect
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/mobile v0.0.0-20210902104108-5d9a33257ab5 // indirect
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 // indirect
)

81
go.sum

@ -0,0 +1,81 @@
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be h1:vEIVIuBApEBQTEJt19GfhoU+zFSV+sNTa9E9FdnRYfk=
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20210727001814-0db043d8d5be/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8=
github.com/go-test/deep v1.0.1 h1:UQhStjbkDClarlmv0am7OXXO4/GaPdCGiUiMTvi28sg=
github.com/go-test/deep v1.0.1/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA=
github.com/hajimehoshi/bitmapfont/v2 v2.1.3 h1:JefUkL0M4nrdVwVq7MMZxSTh6mSxOylm+C4Anoucbb0=
github.com/hajimehoshi/bitmapfont/v2 v2.1.3/go.mod h1:2BnYrkTQGThpr/CY6LorYtt/zEPNzvE/ND69CRTaHMs=
github.com/hajimehoshi/ebiten/v2 v2.2.2/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0=
github.com/hajimehoshi/ebiten/v2 v2.2.3 h1:jZUP3XWP6mXaw9SCrjWT5Pl6EPuz6FY737dZQgN1KJ4=
github.com/hajimehoshi/ebiten/v2 v2.2.3/go.mod h1:olKl/qqhMBBAm2oI7Zy292nCtE+nitlmYKNF3UpbFn0=
github.com/hajimehoshi/file2byteslice v0.0.0-20210813153925-5340248a8f41/go.mod h1:CqqAHp7Dk/AqQiwuhV1yT2334qbA/tFWQW0MD2dGqUE=
github.com/hajimehoshi/go-mp3 v0.3.2/go.mod h1:qMJj/CSDxx6CGHiZeCgbiq2DSUkbK0UbtXShQcnfyMM=
github.com/hajimehoshi/oto v0.6.1/go.mod h1:0QXGEkbuJRohbJaxr7ZQSxnju7hEhseiPx2hrh6raOI=
github.com/hajimehoshi/oto/v2 v2.1.0-alpha.2/go.mod h1:rUKQmwMkqmRxe+IAof9+tuYA2ofm8cAWXFmSfzDN8vQ=
github.com/jakecoffman/cp v1.1.0/go.mod h1:JjY/Fp6d8E1CHnu74gWNnU0+b9VzEdUVPoJxg2PsTQg=
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240 h1:dy+DS31tGEGCsZzB45HmJJNHjur8GDgtRNX9U7HnSX4=
github.com/jezek/xgb v0.0.0-20210312150743-0e0f116e1240/go.mod h1:3P4UH/k22rXyHIJD2w4h2XMqPX4Of/eySEZq9L6wqc4=
github.com/jfreymuth/oggvorbis v1.0.3/go.mod h1:1U4pqWmghcoVsCJJ4fRBKv9peUJMBHixthRlBeD6uII=
github.com/jfreymuth/vorbis v1.0.2/go.mod h1:DoftRo4AznKnShRl1GxiTFCseHr4zR9BN3TWXyuzrqQ=
github.com/kvartborg/vector v0.0.0-20210122071920-91df40ba4054/go.mod h1:GAX7tMJqXx9fB1BrsTWPOXy6IBRX+J461BffVPAdpwo=
github.com/kvartborg/vector v0.1.0 h1:H1ECNOuCvIUZ8ndjvX7p/Soc8ACc7vOEyrjkZV3EwGU=
github.com/kvartborg/vector v0.1.0/go.mod h1:GAX7tMJqXx9fB1BrsTWPOXy6IBRX+J461BffVPAdpwo=
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA=
github.com/qmuntal/gltf v0.20.3 h1:9oW6IAgHROZjwBcEVgkBhH1SR/7TLlVfSn6VDr/2h3E=
github.com/qmuntal/gltf v0.20.3/go.mod h1:ENqYfECmeaqs2BWXWe6OKtMC8ucZII6s9OHr6F5oZ94=
github.com/solarlune/tetra3d v0.4.1 h1:Kxa1/45n1+2CGFmFggSj0gi/GfTYu8NU/8K25ngDsEQ=
github.com/solarlune/tetra3d v0.4.1/go.mod h1:NvInPO329kzPM5kn4G5wnqdGJt5WcG3JESwchU5o0sY=
github.com/solarlune/tetra3d v0.4.2-0.20211213223149-14b690639b14 h1:QLU/j/48hCAwlEq44PnYd3Mg8BZVerGS1fOXogxyT2o=
github.com/solarlune/tetra3d v0.4.2-0.20211213223149-14b690639b14/go.mod h1:NvInPO329kzPM5kn4G5wnqdGJt5WcG3JESwchU5o0sY=
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.0/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56 h1:estk1glOnSVeJ9tdEZZc5mAMDZk5lNJNyJ6DvrBkTEU=
golang.org/x/exp v0.0.0-20190731235908-ec7cb31e5a56/go.mod h1:JhuoJpWY28nO4Vef9tZUw9qufEGTyX1+7lmHxV5q5G4=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190703141733-d6a02ce849c9/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE=
golang.org/x/mobile v0.0.0-20190415191353-3e0bab5405d6/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o=
golang.org/x/mobile v0.0.0-20210902104108-5d9a33257ab5 h1:peBP2oZO/xVnGMaWMCyFEI0WENsGj71wx5K12mRELHQ=
golang.org/x/mobile v0.0.0-20210902104108-5d9a33257ab5/go.mod h1:c4YKU3ZylDmvbw+H/PSvm42vhdWbuxCzbonauEAP9B8=
golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY=
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190429190828-d89cdac9e872/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678 h1:J27LZFQBFoihqXoegpscI10HpjZ7B5WQLLKL2FZXQKw=
golang.org/x/sys v0.0.0-20210917161153-d61c044b1678/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

255
main.go

@ -0,0 +1,255 @@
package main
import (
"embed"
_ "image/png"
"log"
"math"
"github.com/hajimehoshi/ebiten/v2/inpututil"
"github.com/hajimehoshi/ebiten/v2"
"github.com/kvartborg/vector"
"github.com/solarlune/tetra3d"
)
const (
X = iota
Y
Z
)
const (
defaultW = 320
defaultH = 240
)
var boxBrown = tetra3d.NewColor(66/255.0, 40/255.0, 1/255.0, 255/255.0)
//go:embed asset
var assetFS embed.FS
type Game struct {
GameScene *tetra3d.Scene
Camera *tetra3d.Camera
CameraTilt float64
CameraRotate float64
NativeResolution bool
boxes []*tetra3d.Model
boxVelocities []vector.Vector
PrevMousePosition vector.Vector
w, h int
}
func NewGame() *Game {
g := &Game{}
data, err := assetFS.ReadFile("asset/shapes.gltf")
if err != nil {
panic(err)
}
library, err := tetra3d.LoadGLTFData(data, nil)
if err != nil {
panic(err)
}
g.GameScene = library.FindScene("Scene")
//g.GameScene = tetra3d.NewScene("Scene")
g.GameScene.FogMode = tetra3d.FogOff
log.Println(g.GameScene.Root.WorldPosition())
// Tetra uses OpenGL's coordinate system (+X = Right, +Y = Up, +Z = Back),
// in comparison to Blender's coordinate system (+X = Right, +Y = Forward,
// +Z = Up).
g.SetSize(defaultW, defaultH)
const mapSize = 100
for y := 0.0; y < mapSize; y++ {
for x := 0.0; x < mapSize; x++ {
plane := tetra3d.NewCube()
plane.ApplyMatrix(tetra3d.NewMatrix4Scale(5, 0.5, 5))
plane.SetVertexColor(tetra3d.Color{0, 0, 255, 255})
planeModel := tetra3d.NewModel(plane, "plane")
g.GameScene.Root.AddChildren(planeModel)
//planeModel.Rotate(0, 1, 0, math.Pi)
planeModel.SetLocalPosition(vector.Vector{x * 10, -1.5, y * 10})
}
}
return g
}
func (g *Game) updateCamera() {
pos := vector.Vector{0, 2, 2}
if g.Camera == nil {
g.Camera = tetra3d.NewCamera(g.w, g.h)
} else {
pos = g.Camera.LocalPosition()
g.Camera.Resize(g.w, g.h)
}
g.Camera.SetLocalPosition(pos)
}
func (g *Game) Update() error {
pos := g.Camera.LocalPosition()
pos[X] += 0.005
g.Camera.SetLocalPosition(pos)
/*x, y := ebiten.CursorPosition()
if x < 0 {
x = 0
} else if x > g.w {
x = g.w
}
if y < 0 {
y = 0
} else if y > g.h {
y = g.h
}
pctX := float64(x) / float64(g.w)
pctY := float64(y) / float64(g.h)
if pctX < 0 {
pctX = 0
} else if pctX > 1 {
pctX = 1
}
if pctY < 0 {
pctY = 0
} else if pctY > 1 {
pctY = 1
}*/
// Rotating the camera with the mouse
// Rotate and tilt the camera according to mouse movements
mx, my := ebiten.CursorPosition()
mv := vector.Vector{float64(mx), float64(my)}
diff := mv.Sub(g.PrevMousePosition)
g.CameraTilt -= diff[1] * 0.005
g.CameraRotate -= diff[0] * 0.005
g.CameraTilt = math.Max(math.Min(g.CameraTilt, math.Pi/2-0.1), -math.Pi/2+0.1)
tilt := tetra3d.NewMatrix4Rotate(1, 0, 0, g.CameraTilt)
rotate := tetra3d.NewMatrix4Rotate(0, 1, 0, g.CameraRotate)
// Order of this is important - tilt * rotate works, rotate * tilt does not, lol
g.Camera.SetLocalRotation(tilt.Mult(rotate))
g.PrevMousePosition = mv.Clone()
//localRot := tetra3d.NewMatrix4Rotate(1, 1, 1, math.Pi/4-(math.Pi*pctX))
//g.Camera.SetLocalRotation(localRot)
//g.Camera.Rotate(1, 0, 0, math.Pi/4-(math.Pi*pctY))
//localRot = localRot.Rotated(0, 1, 0, math.Pi/4-(math.Pi*pctX))
if inpututil.IsMouseButtonJustPressed(ebiten.MouseButtonLeft) {
g.fireBox()
}
for i, box := range g.boxes {
position := box.LocalPosition()
//log.Printf("%d %+v", i, position)
if position[Y] <= -0.5 {
// Hit ground.
continue
}
pos := box.LocalPosition()
box.SetLocalPosition(pos.Add(g.boxVelocities[i]))
if g.boxVelocities[i][Y] > -0.1 {
g.boxVelocities[i][Y] -= 0.001
}
}
// TODO rotate Y
//_ = pctY
//log.Println(x, y, g.w, g.h, pctX, pctY)
return nil
}
func (g *Game) Draw(screen *ebiten.Image) {
g.Camera.Clear()
g.Camera.RenderNodes(g.GameScene, g.GameScene.Root)
screen.DrawImage(g.Camera.ColorTexture, nil)
//g.Camera.DrawDebugWireframe(screen, g.GameScene.Root, color.Black)
g.Camera.DrawDebugText(screen, 1)
}
func (g *Game) Layout(w, h int) (int, int) {
if g.NativeResolution && (w != g.w || h != g.h) {
g.SetSize(w, h)
}
return g.w, g.h
}
func (g *Game) SetSize(w, h int) {
g.w, g.h = w, h
g.updateCamera()
}
func (g *Game) fireBox() {
mesh := tetra3d.NewCube()
mesh.SetVertexColor(*boxBrown)
mesh.ApplyMatrix(tetra3d.NewMatrix4Scale(0.5, 0.5, 0.5))
box := tetra3d.NewModel(mesh, "Cube")
box.SetLocalPosition(g.Camera.LocalPosition())
//cameraPos := g.Camera.LocalPosition()
cameraRotation := g.Camera.LocalRotation()
scale := 0.2
velocity := vector.Vector{
-cameraRotation[2][0] * scale,
-cameraRotation[2][1] * scale,
-cameraRotation[2][2] * scale,
}
velocity[Y] += 0.1
//log.Printf("%+v", velocity)
g.boxes = append(g.boxes, box)
g.boxVelocities = append(g.boxVelocities, velocity)
g.GameScene.Root.AddChildren(box)
}
func main() {
ebiten.SetWindowTitle("Brown Box Earth Simulator")
ebiten.SetWindowResizable(true)
ebiten.SetMaxTPS(144)
ebiten.SetRunnableOnUnfocused(true) // Note - this currently does nothing in ebiten
ebiten.SetWindowClosingHandled(false) // TODO
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
ebiten.SetCursorMode(ebiten.CursorModeCaptured)
g := NewGame()
parseFlags(g)
if err := ebiten.RunGame(g); err != nil {
panic(err)
}
}
Loading…
Cancel
Save