gui

package
v0.0.0-...-74b5f4e Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2018 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Overview

Package gui defines the interface used by artists in the village.

Index

Constants

View Source
const (
	ScreenWidth  int = 114
	ScreenHeight int = 64
	ImageHeight  int = 64
	ImageWidth   int = 64
	ImageX       int = 25
	ButtonHeight int = 4
	ButtonBuffer int = 1
	ExitX        int = ImageX + ImageHeight + ButtonBuffer
	ExitY        int = ScreenHeight - ButtonHeight
)
View Source
const (
	MODE_DRAWING = 0
	MODE_DONE    = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Pressed    bool
	Horizontal int
	Vertical   int
}

Stuct Action specifies how the app state should change.

type AppState

type AppState struct {
	Cursor Cursor
	Color  color.Color
	Image  *image.Paletted
	Mode   int
}

Struct AppState represents the drawing application state.

func CopyAppState

func CopyAppState(app *AppState) *AppState

CopyAppState makes a deep copy of an AppState.

func NewAppState

func NewAppState() *AppState

NewAppState creates a new AppState.

func (*AppState) ApplyAction

func (app *AppState) ApplyAction(act *Action)

ApplyAction modifies an AppState by an action.

func (*AppState) DrawScreen

func (app *AppState) DrawScreen() *image.NRGBA

DrawScreen draws the user interface of an app.

type Cursor

type Cursor struct {
	Pos      image.Point
	Pressed  bool
	PressPos image.Point
}

Struct Cursor is a cursor position and button state.

It remembers where a button press first started, since that information is used to determine if button actions will happen or not.

Jump to

Keyboard shortcuts

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