Documentation
¶
Overview ¶
Package frontend provides interactive processing of front end pages and access to the backend game. Note that a 'page' can be anything from a menu of options to choose from to a simple request for a password.
The frontend is responsible for coordinating the display of pages to a user and processing their responses. These pages cover logging into the server, account creation, player creation and other non in-game activities. When the player is in-game the frontend will simply pass any input through to the game backend for processing.
Pages typically have a pair of methods - a display part and a processing part. For example accountDisplay and accountProcess. Sometimes there is only a display part, for example greetingDisplay.
The current state is held in an instance of frontend. With frontend.nextFunc being the next method to call when input is received - usually an xxxProcess method.
Each time input is received Parse will be called. The method in nextFunc will be called to handle the input. nextFunc should then call the next xxxDisplay method to send a response to the input processing and setup nextFunc with the method that will process the next input received. Any buffered response will then be sent back before Parse exits. Parse will then be called again when more input is received.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
New returns an instance of frontend initialised with the given io.Writer. The io.Writer is used to send responses back from calling Parse. The new frontend is initialised with a message buffer and nextFunc setup to call greetingDisplay.
func NewAccount ¶
func NewAccount(f *frontend) (a *account)
NewAccount returns an account with the specified frontend embedded. The returned account can be used for processing the creation of new accounts and players.
func NewGame ¶
func NewGame(f *frontend) (g *game)
NewGame returns a game with the specified frontend embedded. The returned game can be used for processing communication to the actual game.
func NewLogin ¶
func NewLogin(f *frontend) (l *login)
NewLogin returns a login with the specified frontend embedded. The returned login can be used for processing the logging in of accounts.
func NewMenu ¶
func NewMenu(f *frontend) (m *menu)
NewMenu returns a menu with the specified frontend embedded. The returned menu can be used for processing the main menu and it's options.
Types ¶
This section is empty.
Source Files
¶
- account.go
- frontend.go
- game.go
- login.go
- menu.go