domain

package
v0.0.0-...-916aed3 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2019 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type City

type City struct {
	// contains filtered or unexported fields
}

City basic city struct

type DrawingBuilder

type DrawingBuilder interface {
	InitDrawingOptions() DrawingBuilder
	Move(dx, dy int) DrawingBuilder
	SwapLarger(isLarger bool) DrawingBuilder
	Draw(screen *ebiten.Image, alpha float64) error
}

DrawingBuilder Drawing options region considering struct of functions for better formatting anything between InitDrawingOptions and Draw are unordered

type MapSprite

type MapSprite struct {
	Cities []*City

	// MapSprite need these implementations
	Spriter
}

MapSprite represents an image.

type MapSpriter

type MapSpriter interface {
	Spriter
}

MapSpriter also implements spriter

func NewMapSprite

func NewMapSprite(screen Screener, spriteImage, spriteImageLarger *ebiten.Image, x, y int, cities []*City) MapSpriter

NewMapSprite generates new map sprite

type Mapper

type Mapper interface {
	Padding(ceiling, left, floor, right int)
	Margin(ceiling, left, floor, right int)
}

Mapper struct using Map must have these methods

type MouseStrokeSource

type MouseStrokeSource struct{}

MouseStrokeSource is a StrokeSource implementation of mouse.

func (*MouseStrokeSource) IsJustReleased

func (m *MouseStrokeSource) IsJustReleased() bool

IsJustReleased gets true if the left mouse btn is released

func (*MouseStrokeSource) Position

func (m *MouseStrokeSource) Position() (int, int)

Position gets the current position of the mouse

type Point

type Point struct {
	// contains filtered or unexported fields
}

Point ...

type Screener

type Screener interface {
	Width() int
	Height() int
}

Screener struct must have width and height; basically screen struct to avoid cyclic dep

type Sprite

type Sprite struct {
	// contains filtered or unexported fields
}

Sprite represents an image.

func (*Sprite) Draw

func (s *Sprite) Draw(screen *ebiten.Image, alpha float64) error

Draw draws the sprite.

func (*Sprite) In

func (s *Sprite) In(x, y int) bool

In returns true if (x, y) is in the sprite, and false otherwise.

func (*Sprite) InitDrawingOptions

func (s *Sprite) InitDrawingOptions() DrawingBuilder

InitDrawingOptions every method in drawing must be preceded to keep the geom and colorm

func (*Sprite) Move

func (s *Sprite) Move(dx, dy int) DrawingBuilder

Move Moves the image to a location; basically Translate

func (*Sprite) MoveBy

func (s *Sprite) MoveBy(x, y int)

MoveBy moves the sprite by (x, y).

func (*Sprite) SwapLarger

func (s *Sprite) SwapLarger(isLarger bool) DrawingBuilder

SwapLarger change image to its bigger alternative if true

type Spriter

type Spriter interface {
	In(x, y int) bool
	MoveBy(x, y int)
	DrawingBuilder
}

Spriter struct must have sprites methods to be called a sprite

func NewSprite

func NewSprite(screen Screener, spriteImage, spriteImageLarger *ebiten.Image, x, y int) Spriter

NewSprite sprite initializer

type Stroke

type Stroke struct {
	// contains filtered or unexported fields
}

Stroke manages the current drag state by mouse.

func NewStroke

func NewStroke(source StrokeSource) *Stroke

NewStroke generates new struct for the stroke algorithm

func (*Stroke) DraggingObject

func (s *Stroke) DraggingObject() interface{}

DraggingObject gets anything the stroke drags

func (*Stroke) IsReleased

func (s *Stroke) IsReleased() bool

IsReleased returns true if stroke is released

func (*Stroke) Position

func (s *Stroke) Position() (int, int)

Position gets the position of the current stroke

func (*Stroke) PositionDiff

func (s *Stroke) PositionDiff() (int, int)

PositionDiff subtracts the stroke between the previous and current state

func (*Stroke) SetDraggingObject

func (s *Stroke) SetDraggingObject(object interface{})

SetDraggingObject sets anything the stroke drags

func (*Stroke) Update

func (s *Stroke) Update()

Update updates the stroke state

type StrokeSource

type StrokeSource interface {
	Position() (int, int)
	IsJustReleased() bool
}

StrokeSource represents a input device to provide strokes.

type TouchStrokeSource

type TouchStrokeSource struct {
	ID int
}

TouchStrokeSource is a StrokeSource implementation of touch.

func (*TouchStrokeSource) IsJustReleased

func (t *TouchStrokeSource) IsJustReleased() bool

IsJustReleased gets true if the touch(mobile) is released

func (*TouchStrokeSource) Position

func (t *TouchStrokeSource) Position() (int, int)

Position gets the current position of the touch(mobile)

Jump to

Keyboard shortcuts

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