Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run conf: prepare to load from index.json #258

Merged
merged 1 commit into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions game.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func Gopt_Game_Main(game Gamer) {
// resource can be a string or fs.Dir object.
func Gopt_Game_Run(game Gamer, resource interface{}, gameConf ...*Config) {
var conf Config
if gameConf != nil {
if gameConf != nil { // TODO(xsw): load from index.json
conf = *gameConf[0]
}
if !conf.DontParseFlags {
Expand Down Expand Up @@ -458,6 +458,8 @@ type projConfig struct {

Map mapConfig `json:"map"`
Camera *cameraConfig `json:"camera"`

Run *Config `json:"run"`
}

func (p *projConfig) getScenes() []*costumeConfig {
Expand Down Expand Up @@ -682,15 +684,15 @@ var (
// -----------------------------------------------------------------------------

type Config struct {
Title string
Index interface{} // where is index, can be file (string) or io.Reader
KeyDuration int
FullScreen bool
DontRunOnUnfocused bool
DontParseFlags bool
Width int
Height int
ScreenshotKey string // screenshot image capture key
Title string `json:"title,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
KeyDuration int `json:"keyDuration,omitempty"`
ScreenshotKey string `json:"screenshotKey,omitempty"` // screenshot image capture key
Index interface{} `json:"-"` // where is index.json, can be file (string) or io.Reader
DontParseFlags bool `json:"-"`
FullScreen bool `json:"fullScreen,omitempty"`
DontRunOnUnfocused bool `json:"pauseOnUnfocused,omitempty"`
}

func (p *Game) runLoop(cfg *Config) (err error) {
Expand Down
Loading