Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Game ¶
type Game struct { Rules `json:"rules,omitempty"` Score int `json:"score,omitempty"` Speed time.Duration `json:"speed,omitempty"` BoardPos geom.Dim `json:"board_pos,omitempty"` NextTile *geom.Tile `json:"next_tile,omitempty"` CurrentTile *geom.Tile `json:"current_tile,omitempty"` Board geom.PointMap `json:"board,omitempty"` Platform Platform `json:"-"` }
Game is the common base struct that contains all data required for a `platform.Platform` to render and manage the Game.
type Platform ¶
type Platform interface { // CaptureInput starts capturing input. It returns an input channel, where all input is // sent through, a stopCapture func to stop capturing after the game stops, and an error // to indicate that capturing is not possiible. CaptureInput(ctx context.Context) (input <-chan *input.Input, stopCapture func(), err error) // ShowMessage shows a generic info message to the user. ShowMessage(message string) // Render is called by the game when the game state updates. An implementation of this // should update it's own presentation state based on the changes inside the game. Render(game Game) // RenderScene is called by the game to render an specific gamer Scene, with specific // options, descriptions, and a given current selection. There is not feedback channel. // The game must be informed via regular input events, which the game will wait for after // calling RenderScene. RenderScene(scene Scene) // Options returns a scene with options that can be managed by the platform. Options() options.Options // Run is a blocking call to start the platform. // This is the last function called to handover control to the // platform code. It is needed because most GUI libs need to // run in the main thread. Run(ctx context.Context) }
type Rules ¶
type Rules struct { TickTime time.Duration // inital tick time to advance the game SpeedStep time.Duration // how much to reduce the ticktime for anytime lines are scored MaxSteps int // max number of ticks the game can take (the default 0 is means infinity) BoardSize geom.Dim // size of the game board PreviewSize geom.Dim // size of the preview box Seed Seed // Seed for randomization }
Click to show internal directories.
Click to hide internal directories.