Remove the -win-x and -win-y options for the ordoor binary
This commit is contained in:
@@ -17,6 +17,9 @@ import (
|
||||
var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
gameMap = flag.String("map", "", "Name of a map, e.g., Chapter01")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
)
|
||||
|
||||
type env struct {
|
||||
@@ -69,7 +72,7 @@ func main() {
|
||||
lastState: state,
|
||||
}
|
||||
|
||||
win, err := ui.NewWindow(env, "View Map "+*gameMap)
|
||||
win, err := ui.NewWindow(env, "View Map "+*gameMap, *winX, *winY)
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create window: %v", err)
|
||||
}
|
||||
|
@@ -12,6 +12,9 @@ import (
|
||||
var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
menuName = flag.String("menu", "", "Name of a menu, e.g. Main")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
)
|
||||
|
||||
func main() {
|
||||
@@ -37,7 +40,7 @@ func main() {
|
||||
log.Fatalf("Couldn't initialize interface: %v", err)
|
||||
}
|
||||
|
||||
win, err := ui.NewWindow(iface, "View Menu: "+*menuName)
|
||||
win, err := ui.NewWindow(iface, "View Menu: "+*menuName, *winX, *winY)
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create window: %v", err)
|
||||
}
|
||||
|
@@ -21,6 +21,9 @@ var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
mapFile = flag.String("map", "", "Prefix path to a .map file, e.g. ./orig/Maps/Chapter01.MAP")
|
||||
txtFile = flag.String("txt", "", "Prefix path to a .txt file, e.g. ./orig/Maps/Chapter01.txt")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
)
|
||||
|
||||
type env struct {
|
||||
@@ -71,7 +74,7 @@ func main() {
|
||||
}
|
||||
env := &env{gameMap: gameMap, set: mapSet, state: state, lastState: state}
|
||||
|
||||
win, err := ui.NewWindow(env, "View Map "+*mapFile)
|
||||
win, err := ui.NewWindow(env, "View Map "+*mapFile, *winX, *winY)
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create window: %v", err)
|
||||
}
|
||||
|
@@ -17,6 +17,9 @@ var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
objFile = flag.String("obj-file", "", "Path of an .obj file, e.g. ./orig/Obj/TZEENTCH.OBJ")
|
||||
objName = flag.String("obj-name", "", "Name of an .obj file, e.g. TZEENTCH")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
)
|
||||
|
||||
type env struct {
|
||||
@@ -68,7 +71,7 @@ func main() {
|
||||
lastState: state,
|
||||
}
|
||||
|
||||
win, err := ui.NewWindow(env, "View Object: "+*objName)
|
||||
win, err := ui.NewWindow(env, "View Object: "+*objName, *winX, *winY)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
@@ -16,6 +16,9 @@ import (
|
||||
var (
|
||||
gamePath = flag.String("game-path", "./orig", "Path to a WH40K: Chaos Gate installation")
|
||||
setName = flag.String("set", "", "Name of a set, e.g., map01")
|
||||
|
||||
winX = flag.Int("win-x", 1280, "Pre-scaled window X dimension")
|
||||
winY = flag.Int("win-y", 1024, "Pre-scaled window Y dimension")
|
||||
)
|
||||
|
||||
type env struct {
|
||||
@@ -58,7 +61,7 @@ func main() {
|
||||
lastState: state,
|
||||
}
|
||||
|
||||
win, err := ui.NewWindow(env, "View Set: "+*setName)
|
||||
win, err := ui.NewWindow(env, "View Set: "+*setName, *winX, *winY)
|
||||
if err != nil {
|
||||
log.Fatal("Couldn't create window: %v", err)
|
||||
}
|
||||
|
@@ -19,11 +19,7 @@ type Game interface {
|
||||
|
||||
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`")
|
||||
cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`")
|
||||
)
|
||||
|
||||
type Window struct {
|
||||
@@ -36,12 +32,15 @@ type Window struct {
|
||||
|
||||
debug bool
|
||||
firstRun bool
|
||||
|
||||
xRes int
|
||||
yRes int
|
||||
}
|
||||
|
||||
// 0,0 is the *top left* of the window
|
||||
//
|
||||
// ebiten assumes a single window, so only call this once...
|
||||
func NewWindow(game Game, title string) (*Window, error) {
|
||||
func NewWindow(game Game, title string, xRes int, yRes int) (*Window, error) {
|
||||
ebiten.SetRunnableInBackground(true)
|
||||
|
||||
return &Window{
|
||||
@@ -50,6 +49,8 @@ func NewWindow(game Game, title string) (*Window, error) {
|
||||
debug: true,
|
||||
firstRun: true,
|
||||
game: game,
|
||||
xRes: xRes,
|
||||
yRes: yRes,
|
||||
}, nil
|
||||
}
|
||||
|
||||
@@ -63,7 +64,7 @@ func (w *Window) OnMouseWheel(f func(x, y float64)) {
|
||||
}
|
||||
|
||||
func (w *Window) Layout(_, _ int) (int, int) {
|
||||
return *winX, *winY
|
||||
return w.xRes, w.yRes
|
||||
}
|
||||
|
||||
func (w *Window) Update(screen *ebiten.Image) error {
|
||||
@@ -120,7 +121,7 @@ func (w *Window) Run() error {
|
||||
defer pprof.StopCPUProfile()
|
||||
}
|
||||
|
||||
ebiten.SetWindowSize(int(float64(*winX)**screenScale), int(float64(*winY)**screenScale))
|
||||
ebiten.SetWindowSize(int(float64(w.xRes)*(*screenScale)), int(float64(w.yRes)*(*screenScale)))
|
||||
ebiten.SetWindowTitle(w.Title)
|
||||
return ebiten.RunGame(w) // Native game resolution: 640x480
|
||||
return ebiten.RunGame(w)
|
||||
}
|
||||
|
Reference in New Issue
Block a user