Respect sprite X and Y offsets
This makes menus display more correctly, and also fixes trees and other objects on the main map, although it messes up bounds clipping (sigh).
This commit is contained in:
@@ -15,6 +15,9 @@ import (
|
||||
var (
|
||||
screenScale = flag.Float64("screen-scale", 1.0, "Scale the window by this factor")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
|
||||
cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
|
||||
)
|
||||
|
||||
@@ -27,7 +30,7 @@ type Window struct {
|
||||
updateFn func() error
|
||||
drawFn func(*ebiten.Image) error
|
||||
|
||||
debug bool
|
||||
debug bool
|
||||
firstRun bool
|
||||
}
|
||||
|
||||
@@ -103,16 +106,16 @@ func (w *Window) Run(updateFn func() error, drawFn func(*ebiten.Image) error) er
|
||||
w.drawFn = drawFn
|
||||
|
||||
if *cpuprofile != "" {
|
||||
f, err := os.Create(*cpuprofile)
|
||||
if err != nil {
|
||||
log.Fatal("could not create CPU profile: ", err)
|
||||
}
|
||||
defer f.Close() // error handling omitted for example
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
log.Fatal("could not start CPU profile: ", err)
|
||||
}
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
f, err := os.Create(*cpuprofile)
|
||||
if err != nil {
|
||||
log.Fatal("could not create CPU profile: ", err)
|
||||
}
|
||||
defer f.Close() // error handling omitted for example
|
||||
if err := pprof.StartCPUProfile(f); err != nil {
|
||||
log.Fatal("could not start CPU profile: ", err)
|
||||
}
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
||||
return ebiten.Run(w.run, 640, 480, 1, w.Title) // Native game resolution: 640x480
|
||||
return ebiten.Run(w.run, *winX, *winY, 1, w.Title) // Native game resolution: 640x480
|
||||
}
|
||||
|
Reference in New Issue
Block a user