Metroidvania video game
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.0 KiB

package main
import (
"log"
"os"
"os/signal"
"syscall"
"code.rocketnine.space/tslocum/doctorlectro/asset"
"code.rocketnine.space/tslocum/doctorlectro/game"
"code.rocketnine.space/tslocum/doctorlectro/world"
"github.com/hajimehoshi/ebiten/v2"
)
func main() {
ebiten.SetWindowTitle("Doctor Lectro")
ebiten.SetWindowResizable(true)
ebiten.SetWindowSize(world.ScreenWidth, world.ScreenHeight)
ebiten.SetMaxTPS(world.TPS)
ebiten.SetRunnableOnUnfocused(true) // Note - this currently does nothing in ebiten
ebiten.SetWindowClosingHandled(true)
ebiten.SetFPSMode(ebiten.FPSModeVsyncOn)
ebiten.SetCursorMode(ebiten.CursorModeHidden)
asset.SoundFire.SetVolume(0.6)
asset.SoundHit.SetVolume(0.4)
asset.SoundExplode.SetVolume(0.6)
asset.SoundMusic.SetVolume(0.6)
parseFlags()
g, err := game.NewGame()
if err != nil {
log.Fatal(err)
}
sigc := make(chan os.Signal, 1)
signal.Notify(sigc,
syscall.SIGINT,
syscall.SIGTERM)
go func() {
<-sigc
g.Exit()
}()
err = ebiten.RunGame(g)
if err != nil {
log.Fatal(err)
}
}