Version: v0.1.0 Latest Latest

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

Go to latest
Published: Feb 6, 2021 License: Apache-2.0 Imports: 20 Imported by: 0



Package ebiten contains an engine backend that uses ebiten. Enabled by default, disabled by the `headless` build tag



This section is empty.


This section is empty.


This section is empty.


type Animation

type Animation struct {
	// contains filtered or unexported fields

Animation is an engine.Animation.

func (*Animation) Pause

func (a *Animation) Pause()

Pause implements engine.Animation.

func (*Animation) Play

func (a *Animation) Play()

Play implements engine.Animation.

func (*Animation) Reset

func (a *Animation) Reset()

Reset implements engine.Animation.

func (*Animation) SetState

func (a *Animation) SetState(state string)

SetState implements engine.Animation.

func (*Animation) SetTickCount

func (a *Animation) SetTickCount(count int)

SetTickCount implements engine.Animation.

func (*Animation) Size

func (a *Animation) Size() (int, int)

Size implements engine.Image.

type Asset

type Asset struct {
	// contains filtered or unexported fields

Asset is an engine.Asset.

func (*Asset) ToAnimation

func (a *Asset) ToAnimation() engine.Animation

ToAnimation implements the ToAnimation method of engine.Asset.

func (*Asset) ToAtlas

func (a *Asset) ToAtlas() engine.Atlas

ToAtlas implements the ToAtlas method of engine.Asset.

func (*Asset) ToImage

func (a *Asset) ToImage() engine.Image

ToImage implements the ToImage method of engine.Asset.

func (*Asset) ToSound

func (a *Asset) ToSound() engine.Sound

ToSound implements the ToSound method of engine.Asset.

func (*Asset) UnmarshalBinary

func (a *Asset) UnmarshalBinary(data []byte) error

UnmarshalBinary implements encoding.BinaryUnmarshaler.

type Atlas

type Atlas struct {
	// contains filtered or unexported fields

Atlas is an engine.Atlas.

func (*Atlas) GetImage

func (a *Atlas) GetImage(k string) engine.Image

GetImage implements engine.Atlas.

type Game

type Game struct {
	// contains filtered or unexported fields

Game is an ebiten implementation of engine.Game.

func NewGame

func NewGame(
	title string,
	w, h int,
	flags byte,
	tickFunc func(),
	layoutFunc func(int, int) (int, int),
) *Game

NewGame returns an instantiated game.

func (*Game) AddRenderer

func (g *Game) AddRenderer(renderer ...engine.Renderer)

AddRenderer adds a renderer to the draw stack.

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

Draw runs the draw functions.

func (Game) IsFocused

func (g Game) IsFocused() bool

IsFocused returns the focused state of the game.

func (Game) IsFullscreen

func (g Game) IsFullscreen() bool

IsFullscreen returns the fullscreen state of the game.

func (Game) IsVsync

func (g Game) IsVsync() bool

IsVsync returns the vsync state of the game.

func (*Game) Layout

func (g *Game) Layout(ow, oh int) (int, int)

Layout is called when the window resizes.

func (Game) NewAnimationFromAssetPath

func (c Game) NewAnimationFromAssetPath(path string) (engine.Animation, error)

func (Game) NewAssetFromPath

func (c Game) NewAssetFromPath(path string) (engine.Asset, error)

func (Game) NewAtlasFromAssetPath

func (c Game) NewAtlasFromAssetPath(path string) (engine.Atlas, error)

func (Game) NewCamera

func (c Game) NewCamera() engine.Camera

func (Game) NewCollider

func (c Game) NewCollider() engine.Collider

func (Game) NewImageFromAssetPath

func (c Game) NewImageFromAssetPath(path string) (engine.Image, error)

func (Game) NewImageFromImage

func (c Game) NewImageFromImage(img image.Image) engine.Image

func (Game) NewImageFromPath

func (c Game) NewImageFromPath(path string) (engine.Image, error)

func (Game) NewIsoRenderer

func (c Game) NewIsoRenderer() engine.IsoRenderer

func (Game) NewRenderer

func (c Game) NewRenderer() engine.Renderer

func (Game) NewSoundFromAssetPath

func (c Game) NewSoundFromAssetPath(path string) (engine.Sound, error)

func (Game) NewTextImage

func (c Game) NewTextImage(txt string, w, h int, face font.Face, clr color.Color) engine.Image

func (Game) NewTilemap

func (c Game) NewTilemap(
	width int,
	data [2][][]int,
	mapper map[int]engine.Image,
	overlapEvent engine.TileOverlapEvent,
) engine.Tilemap

func (*Game) Run

func (g *Game) Run() error

Run starts up the engine and begins running the game.

func (Game) SetFullscreen

func (g Game) SetFullscreen(v bool)

SetFullscreen sets the fullscreen state of the game.

func (Game) SetVsync

func (g Game) SetVsync(v bool)

SetVsync sets the vsync state of the game.

func (*Game) Update

func (g *Game) Update() error

Update runs the tick functions.

type Image

type Image struct {
	// contains filtered or unexported fields

Image is an ebiten implementation of engine.Image.

func (*Image) Alpha

func (i *Image) Alpha(alpha float64)

Alpha sets the alpha channel of the image.

func (*Image) Class

func (i *Image) Class() string

Class implements engine.Image.

func (*Image) Dispose

func (i *Image) Dispose()

Dispose marks the image to be disposed.

func (*Image) IsDisposed

func (i *Image) IsDisposed() bool

IsDisposed indicates if the image has been dispoed.

func (*Image) IsRenderable

func (i *Image) IsRenderable() bool

IsRenderable returns the render state of the image.

func (*Image) Offset

func (i *Image) Offset(x, y float64)

Offset applies the translation offset.

func (*Image) Origin

func (i *Image) Origin(x, y float64)

Origin sets the image origin by percent ranging from 0.0 to 1.0

func (*Image) Position

func (i *Image) Position() engine.Vec2

Position implements engine.Image.

func (*Image) Rotate

func (i *Image) Rotate(d float64)

Rotate sets the image rotation.

func (*Image) RoundTranslations

func (i *Image) RoundTranslations(round bool)

RoundTranslations sets whether or not image translations will be rounded during rendering.

func (*Image) Scale

func (i *Image) Scale(x, y float64)

Scale sets the image scale.

func (*Image) SetRenderable

func (i *Image) SetRenderable(r bool)

SetRenderable sets the render state of the image.

func (*Image) SetZDepth

func (i *Image) SetZDepth(z int)

SetZDepth sets the z order override.

func (*Image) Size

func (i *Image) Size() (int, int)

Size returns the image size.

func (*Image) Tint

func (i *Image) Tint(r, g, b float64)

Tint sets the color scale of the image.

func (*Image) Translate

func (i *Image) Translate(x, y float64)

Translate sets the image translation.

func (*Image) TriggersTileOverlapEvent

func (i *Image) TriggersTileOverlapEvent(triggers bool)

TriggersTileOverlapEvent determines whether or not the tile overlap event will occur when this image is behind a tile in the isometric renderer.

func (*Image) Undispose

func (i *Image) Undispose()

Undispose resets the disposed state of the image.

type Input

type Input struct {
	// contains filtered or unexported fields

Input is an engine.Input.

func (*Input) CursorPosition

func (i *Input) CursorPosition() (int, int)

CursorPosition implements engine.Input.

func (*Input) IsAnyKeyJustPressed

func (i *Input) IsAnyKeyJustPressed() bool

IsAnyKeyJustPressed implements engine.Input.

func (*Input) IsAnyKeyPressed

func (i *Input) IsAnyKeyPressed() bool

IsAnyKeyPressed implements engine.Input.

func (*Input) IsKeyJustPressed

func (i *Input) IsKeyJustPressed(k int) bool

IsKeyJustPressed implements engine.Input.

func (*Input) IsKeyJustReleased

func (i *Input) IsKeyJustReleased(k int) bool

IsKeyJustReleased implements engine.Input.

func (*Input) IsKeyPressed

func (i *Input) IsKeyPressed(k int) bool

IsKeyPressed implements engine.Input.

func (*Input) IsMouseButtonJustPressed

func (i *Input) IsMouseButtonJustPressed(k int) bool

IsMouseButtonJustPressed implements engine.Input.

func (*Input) IsMouseButtonJustReleased

func (i *Input) IsMouseButtonJustReleased(k int) bool

IsMouseButtonJustReleased implements engine.Input.

func (*Input) IsMouseButtonPressed

func (i *Input) IsMouseButtonPressed(k int) bool

IsMouseButtonPressed implements engine.Input.

func (*Input) SetCursorBounds

func (i *Input) SetCursorBounds(minX, minY, maxX, maxY int)

SetCursorBounds implements engine.Input.

func (*Input) SetCursorMode

func (i *Input) SetCursorMode(mode engine.CursorMode)

SetCursorMode implements engine.Input.

type IsoRenderer

type IsoRenderer struct {
	// contains filtered or unexported fields

IsoRenderer is an engine.IsoRenderer.

func NewIsoRenderer

func NewIsoRenderer() *IsoRenderer

NewIsoRenderer creates an empty IsoRenderer.

func (*IsoRenderer) SetTilemap

func (r *IsoRenderer) SetTilemap(tilemap engine.Tilemap)

SetTilemap implements engine.IsoRenderer.

type Renderer

type Renderer struct {
	// contains filtered or unexported fields

Renderer is a simple ebiten renderer.

func NewRenderer

func NewRenderer() *Renderer

NewRenderer creates an empty Renderer.

func (*Renderer) AddImage

func (r *Renderer) AddImage(images ...engine.Image)

AddImage adds images to the draw stack.

func (*Renderer) ScreenToWorld

func (r *Renderer) ScreenToWorld(screen engine.Vec2) engine.Vec2

ScreenToWorld implements engine.Renderer.

func (*Renderer) SetCamera

func (r *Renderer) SetCamera(camera engine.Camera)

SetCamera implements engine.Renderer.

func (*Renderer) SetViewport

func (r *Renderer) SetViewport(w, h int)

SetViewport implements engine.Renderer.

func (*Renderer) Tick

func (r *Renderer) Tick()

Tick implements engine.Renderer.

func (*Renderer) Viewport

func (r *Renderer) Viewport() image.Rectangle

Viewport implements engine.Renderer.

type Sound

type Sound struct {
	// contains filtered or unexported fields

Sound is an ebiten implementation of engine.Sound.

func (*Sound) Close

func (s *Sound) Close()

Close implements the Close method of engine.Sound.

func (*Sound) Loop

func (s *Sound) Loop() error

Loop implements the Loop method of engine.Sound.

func (*Sound) Pause

func (s *Sound) Pause()

Pause implements the Pause method of engine.Sound.

func (*Sound) Play

func (s *Sound) Play() error

Play implements the Play method of engine.Sound.

func (*Sound) Reset

func (s *Sound) Reset()

Reset implements the Reset method of engine.Sound.

type SoundControl

type SoundControl struct {
	// contains filtered or unexported fields

SoundControl is an ebiten implementation of engine.SoundControl.

func NewSoundControl

func NewSoundControl() *SoundControl

NewSoundControl returns an instantiated *SoundControl.

func (*SoundControl) SetVolume

func (sc *SoundControl) SetVolume(group string, v float64)

SetVolume implements the SetVolume method of engine.SoundControl.

func (*SoundControl) Volume

func (sc *SoundControl) Volume(group string) (v float64)

Volume implements the Volume method of engine.SoundControl.

Jump to

Keyboard shortcuts

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