Documentation
¶
Index ¶
- Constants
- Variables
- func BuildTheme(appConf *Config) (*theme.Theme, error)
- func DPI(pixelsPerPt float32) float64
- func Main(title string, appConf *Config)
- func Packaging(dstDir string, appConf *Config, appConfPath string, extraFiles []string) bool
- func SetLogConfig(appConf *Config) (func(), error)
- func Testing(appConf *Config, scriptFiles []string) bool
- type Config
- type FpsLimitter
- type ModelErrorFilter
- type PaintScheduled
- type UI
Constants ¶
const ( // default configuration file. ConfigFile = "erago.conf" DefaultBaseDir = erago.DefaultBaseDir LogFileStdOut = "stdout" // specify log outputs to stdout LogFileStdErr = "stderr" // specify log outputs to stderr DefaultLogFile = "erago.log" // default output log file. LogLevelInfo = "info" // logging only information level. LogLevelDebug = "debug" // logging all levels, debug and info. DefaultLogLevel = LogLevelInfo DefaultLogLimitMegaByte = 10 // 10 * 1000 * 1000 Bytes DefaultFont = "" // font file. empty means use builtin font. DefaultFontSize = 12.0 // font size in pt DefaultWidth = 800 // initial window width DefaultHeight = 600 // initial window height DefaultTestingTimeoutSecond = int(erago.DefaultTestingTimeout / time.Second) )
Variables ¶
var DefaultAppTextViewOptions = ui.DefaultTextViewOptions
var ErrDefaultConfigGenerated error = errors.New("default config generated")
ErrDefaultConfigGenerated implies that the specified config file is not found, and intead of that default config is generated and used.
Functions ¶
func BuildTheme ¶
build new theme according to application configure.
func Main ¶
entry point of main application. appconf nil is OK, use default if it is. its internal errors are handled by itself.
func Packaging ¶ added in v0.9.0
Packaging package erago related files ELA/*, CSV/*, appConf file, and given extra files on appConf context. The packaging result is stored under dstDir. File name is {{csv.GameBase.Title}}-{{csv.GameBase.Version}}.zip If same file name already exist, packaging will fail. It returns whether operation succeeded or not. internal error is handled by itself.
func SetLogConfig ¶ added in v0.5.0
set log configuration and return finalize function with internal error. when returned error, the finalize function is nil and need not be called.
Types ¶
type Config ¶
type Config struct { LogFile string `toml:"logfile"` LogLevel string `toml:"loglevel"` LogLimitMegaByte int64 `toml:"loglimit_megabytes"` Font string `toml:"font"` // path for fontfile. empty means that use builtin font. FontSize float64 `toml:"fontsize"` // font size in pt. Width int `toml:"width"` // initial window width. Height int `toml:"height"` // initial window height. // number of lines or bytes per line stored in history. // these can take 0 or negative in which case use default value instead. HistoryLineCount int `toml:"history_line_count"` // timeout value for testing mode only, in second. TestingTimeoutSecond int `toml:"testing_timeout_sec"` Game erago.Config `toml:"game"` }
Configure for the Applicaltion. To build this, use NewConfig instead of struct constructor, AppConfig{}.
func LoadConfigOrDefault ¶
if config file exists load it and return. if not exists return default config and write it.
type FpsLimitter ¶
type FpsLimitter struct { EventDeque screen.EventDeque FPS int // zero FPS means no limit fps. // contains filtered or unexported fields }
fpsLimitter limits and delays paint events to not exceed over specified fps. To construct this:
fps := FpsLimitter{EventDeque: deque, FPS: fps}
zero value is invalid.
func (*FpsLimitter) Filter ¶
func (l *FpsLimitter) Filter(ev interface{}) interface{}
Filter handles paint event to limits fps. if paint event is delayed, return type paintSchedule and consume paint event. other events are returned itself.
type ModelErrorFilter ¶
type ModelErrorFilter struct {
// contains filtered or unexported fields
}
ModelErrorFilter filters ui.EragoPresenter's ModelError.
func (ModelErrorFilter) Err ¶
func (me ModelErrorFilter) Err() error
return internal error. it is valid when model error is arrived.
func (*ModelErrorFilter) Filter ¶
func (me *ModelErrorFilter) Filter(e interface{}) interface{}
func (*ModelErrorFilter) Reset ¶ added in v0.5.0
func (me *ModelErrorFilter) Reset()
Reset resets internal error state.
type PaintScheduled ¶
type PaintScheduled struct{}
paintSchedule notifies setting a new schedule which sends paint event after some time.
type UI ¶
type UI struct { node.ShellEmbed // These Backgrounds fill each widgets by background color. // To change color you can modify XXXBackground.ThemeColor. CmdLineBackground *widget.Uniform // contains filtered or unexported fields }
UI is mixture of widgets in ui package.
func NewUI ¶
func NewUI(presenter *ui.EragoPresenter, appConf *Config) *UI
construct standard UI node tree for the era application.
func (*UI) OnInputEvent ¶ added in v0.9.0
func (ui *UI) OnInputEvent(e interface{}, origin image.Point) node.EventHandled
func (*UI) OnLifecycleEvent ¶
implement node.Node interface.