model

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2020 License: BSD-3-Clause Imports: 11 Imported by: 0

Documentation

Overview

package model is a Go interface for the mobile devices on the Model level.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(ui UI, baseDir string) error

func Main

func Main(appContext AppContext)

run game thread. the game thread runs on background so it returns imediately. quiting the game thread is notifyed through AppContext.NotifyQuit().

func Quit

func Quit()

func SendCommand

func SendCommand(cmd string)

func SendSkippingWait

func SendSkippingWait()

func SendStopSkippingWait

func SendStopSkippingWait()

func StringWidth

func StringWidth(text string) int32

Types

type AppContext

type AppContext interface {
	// it is called when mobile.app is quited.
	// the native framework must be quited by this signal.
	// the argument erorr indicates why app is quited.
	// nil error means quit correctly.
	NotifyQuit(error)
}

AppContext manages application context.

type Printer

type Printer interface {
	Print(s string) error
	PrintLabel(s string) error
	PrintButton(caption, command string) error
	PrintLine(sym string) error
	SetColor(c int32) error
	GetColor() (int32, error)
	ResetColor() error
	SetAlignmentLeft() error
	SetAlignmentCenter() error
	SetAlignmentRight() error
	NewPage() error
	ClearLine(nline int32) error
	ClearLineAll() error
	WindowLineWidth() (int32, error)
	WindowLineCount() (int32, error)
	CurrentLineWidth() (int32, error)
	LineCount() (int32, error)
}

Printer is interface for the printing content to the view. Any functions of this are called asynchronously.

type UI

type UI interface {
	Printer

	// it is called when mobile.app requires synchronized output
	// state to UI view.
	Sync() error

	// it is called when mobile.app requires inputting
	// user's command.
	OnCommandRequested()

	// it is called when mobile.app requires just input any command.
	OnInputRequested()

	// it is called when mobile.app no longer requires any input,
	// such as just-input and command.
	OnInputRequestClosed()
}

erago.UI for java bind.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL