egui

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

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

Map represents a UI Map element.

func (*Map) Draw

func (e *Map) Draw(dst *ebiten.Image)

Draw is called during a game update

func (*Map) IsDestroyed

func (e *Map) IsDestroyed() bool

IsDestroyed returns true when the element is flagged for deletion

func (*Map) IsEnabled

func (e *Map) IsEnabled() bool

IsEnabled returns true if a map is enabled

func (*Map) IsVisible

func (e *Map) IsVisible() bool

IsVisible returns true if mob is visible

func (*Map) LerpPosition

func (e *Map) LerpPosition(endPosition common.Vector, duration time.Duration, isDestroyed bool, endFunc func())

LerpPosition changes an element's position over duration

func (*Map) Name

func (e *Map) Name() string

Name returns a mob's name

func (*Map) RenderIndex

func (e *Map) RenderIndex() int64

RenderIndex returns the render index of element

func (*Map) Route

func (e *Map) Route(startX, startY, endX, endY int) ([]*common.Edge, error)

Route determines a route based on start and end tile poisitions

func (*Map) SetData

func (e *Map) SetData(data MapData) error

SetData sets a map's data

func (*Map) SetEnabled

func (e *Map) SetEnabled(isEnabled bool)

SetEnabled changes if a map is enabled

func (*Map) SetIsDestroyed

func (e *Map) SetIsDestroyed(isDestroyed bool)

SetIsDestroyed sets an element to be destroyed on next update

func (*Map) SetOnPressFunction

func (e *Map) SetOnPressFunction(f func())

SetOnPressFunction lets you pass a function without the need of map handling

func (*Map) SetOnPressed

func (e *Map) SetOnPressed(f func(e *Map))

SetOnPressed sets a map state

func (*Map) SetRenderIndex

func (e *Map) SetRenderIndex(renderIndex int64)

SetRenderIndex sets the render index of element

func (*Map) SetShape

func (e *Map) SetShape(shape common.Rectangle)

SetShape sets an element's X/Y position as well as width/height

func (*Map) SetText

func (e *Map) SetText(text string)

SetText changes the text on the map

func (*Map) SetVisible

func (e *Map) SetVisible(isVisible bool)

SetVisible changes the visibility of a map

func (*Map) Shape

func (e *Map) Shape() *common.Rectangle

Shape returns an element's X/Y position as well as width/height

func (*Map) TileX

func (e *Map) TileX(x float64) int

TileX converts a egui position to a tile position

func (*Map) TileY

func (e *Map) TileY(y float64) int

TileY converts a egui position to a tile position

func (*Map) Update

func (e *Map) Update(dt float64)

Update is called during a game update

func (*Map) X

func (e *Map) X() float64

X returns the X position of a map

func (*Map) Y

func (e *Map) Y() float64

Y returns the Y position of a map

type MapCollider

type MapCollider struct {
	IsCollider bool    `json:"is_collider,omitempty"`
	Cost       float32 `json:"cost,omitempty"`
}

MapCollider is a boolean if a collider is true or not

type MapData

type MapData struct {
	Source          string `json:"source,omitempty"`
	Width           int64  `json:"width,omitempty"`
	Height          int64  `json:"height,omitempty"`
	TileWidth       int64  `json:"tile_width,omitempty"`
	TileHeight      int64  `json:"tile_height,omitempty"`
	TileCount       int64  `json:"tile_count,omitempty"`
	TileSheetWidth  int64
	TileSheetHeight int64
	TileFrames      []image.Rectangle
	Layers          []MapLayer    `json:"layers,omitempty"`
	Colliders       []MapCollider `json:"colliders,omitempty"`
}

MapData contains map related information

type MapLayer

type MapLayer struct {
	Name    string    `json:"name,omitempty"`
	Opacity float32   `json:"opacity,omitempty"`
	Tiles   []MapTile `json:"tiles,omitempty"`
}

MapLayer contains layer data

type MapTile

type MapTile struct {
	GID uint32 `json:"gid,omitempty"`
}

MapTile contains the Gid of a specified tile

func (MapTile) D

func (mt MapTile) D() bool

D returns true if diagonal flagged

func (MapTile) H

func (mt MapTile) H() bool

H reads if the tile should be changed horizontal

func (MapTile) Index

func (mt MapTile) Index() uint32

Index returns a map tile's index

func (MapTile) SetD

func (mt MapTile) SetD(val bool)

SetD changes the horizontal flag

func (MapTile) SetH

func (mt MapTile) SetH(val bool)

SetH changes the horizontal flag

func (MapTile) SetV

func (mt MapTile) SetV(val bool)

SetV changes the horizontal flag

func (MapTile) V

func (mt MapTile) V() bool

V returns true if a vertical rotation is in place

Jump to

Keyboard shortcuts

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