Documentation ¶
Index ¶
- Constants
- func Testing(conf Config, script_files []string) error
- type Config
- type Game
- func (g *Game) Init(ui uiadapter.UI, config Config) error
- func (g Game) InputPort() uiadapter.Sender
- func (g *Game) Main() error
- func (g *Game) Quit()
- func (g *Game) RegisterAllRequestObserver(obs uiadapter.RequestObserver)
- func (g *Game) RegisterRequestObserver(typ uiadapter.InputRequestType, obs uiadapter.RequestObserver)
- func (g *Game) Send(ev input.Event)
- func (g *Game) UnregisterAllRequestObserver()
- func (g *Game) UnregisterRequestObserver(typ uiadapter.InputRequestType)
Constants ¶
const ( DefaultSaveFileDir = "sav" DefaultCSVDir = "CSV" DefaultCSVCharaPattern = "Chara/Chara*" DefaultScriptDir = "ELA" )
const DefaultBaseDir = "./"
by default, use current dir of running main.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct { SceneConfig scene.Config `toml:"scene"` RepoConfig repo.Config `toml:"save"` CSVConfig csv.Config `toml:"csv"` ScriptConfig script.Config `toml:"script"` }
Config holds parameters associating with Game running. It might be constructed by NewConfig, not Config{}.
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game is entry point of the application. It implements Sender interface to send user event from external. Sender is valid after Game.Init(), so accsessing it causes panic before initializing.
Game object is invalid after retruned from Game.Main() or calling Game.Quit(). To reuse it, you must call Game.Init() first, then call Main().
func NewGame ¶
func NewGame() *Game
Constructs game object with config. If nil config is given use default config insteadly.
func (*Game) Init ¶
Initialize game by UserInterface and game config. It returns error of initializing game. The empty game config is ok in which use default game Config.
After this, Game.Sender is available.
func (Game) InputPort ¶
It return input port which is used to send user event. But game implements Sender interface, so using this may be special case.
func (*Game) Main ¶
Run game main flow. It blocks until causing something of error in the flow. So you should use it in the other thread.
Example:
go func() { game.Main(ctx) }()
It returns nil if game quits correctly, otherwise return erorr containing any panic in the flow.
func (*Game) Quit ¶
func (g *Game) Quit()
implements uiadapter.Sender interface. quit game by external.
func (*Game) RegisterAllRequestObserver ¶ added in v0.5.0
func (g *Game) RegisterAllRequestObserver(obs uiadapter.RequestObserver)
helper function to register handler for all of input request type.
func (*Game) RegisterRequestObserver ¶ added in v0.5.0
func (g *Game) RegisterRequestObserver(typ uiadapter.InputRequestType, obs uiadapter.RequestObserver)
implements uiadapter.Sender interface. add input request chaged ovserver which can be used asynchrobously.
func (*Game) Send ¶
implements uiadapter.Sender interface. send input event to game running. it can be used asynchrobously. For more detail for input event, see input package.
func (*Game) UnregisterAllRequestObserver ¶ added in v0.5.0
func (g *Game) UnregisterAllRequestObserver()
helper function to unregister handler for all of input request type.
func (*Game) UnregisterRequestObserver ¶ added in v0.5.0
func (g *Game) UnregisterRequestObserver(typ uiadapter.InputRequestType)
remove input request chaged ovserver which can be used asynchrobously.
Directories ¶
Path | Synopsis |
---|---|
package attribute contains property for view interface.
|
package attribute contains property for view interface. |
infra
|
|
mobile
|
|
model
package model is a Go interface for the mobile devices on the Model level.
|
package model is a Go interface for the mobile devices on the Model level. |
csv
Package csv provides csv-parser for game parameter names.
|
Package csv provides csv-parser for game parameter names. |
package uiadapter converts UI interface to model interface
|
package uiadapter converts UI interface to model interface |
macro
macro syntax is that 1.
|
macro syntax is that 1. |
errutil
Package errutil provides utilty of errors.
|
Package errutil provides utilty of errors. |
log
package log defines strict logger types, which is referenced from https://dave.cheney.net/2015/11/05/lets-talk-about-logging.
|
package log defines strict logger types, which is referenced from https://dave.cheney.net/2015/11/05/lets-talk-about-logging. |
view
|
|
exp/text
package text provides contents holder cotaining plain-text, clickable-text-button, ...
|
package text provides contents holder cotaining plain-text, clickable-text-button, ... |
exp/text/pubdata
package pubdata intended for exporting data structure for other platforms such as mobile, wasm and so on.
|
package pubdata intended for exporting data structure for other platforms such as mobile, wasm and so on. |
exp/text/publisher/mock
Package mock_publisher is a generated GoMock package.
|
Package mock_publisher is a generated GoMock package. |
exp/theme
package theme defines custom theme for UI.
|
package theme defines custom theme for UI. |
package width provides methods to get text width defined by unicode east asisn width.
|
package width provides methods to get text width defined by unicode east asisn width. |