render

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DrawText

func DrawText(o *TextOptions, txt string)

Types

type Camera

type Camera struct {
	Originable

	Pitch float64

	Mode CameraMode
	// contains filtered or unexported fields
}

func NewCamera

func NewCamera(x, y float64) *Camera

func (*Camera) GetMultiplier

func (c *Camera) GetMultiplier() float64

func (*Camera) Position

func (c *Camera) Position() (float64, float64)

func (*Camera) Rotation

func (c *Camera) Rotation() float64

func (*Camera) ScreenToWorld

func (c *Camera) ScreenToWorld(x, y float64) (float64, float64)

func (*Camera) SetMode

func (c *Camera) SetMode(mode CameraMode)

func (*Camera) SetPosition

func (c *Camera) SetPosition(x, y float64)

func (*Camera) SetRotation

func (c *Camera) SetRotation(rotation float64)

func (*Camera) SetRotationAt

func (c *Camera) SetRotationAt(rotation float64, speed float64)

func (*Camera) SetStory

func (c *Camera) SetStory(level int)

func (*Camera) SetTextOffset

func (c *Camera) SetTextOffset(offset float64)

func (*Camera) SetZoom

func (c *Camera) SetZoom(zoom float64)

func (*Camera) Story

func (c *Camera) Story() int

func (*Camera) TextOffset

func (c *Camera) TextOffset() float64

func (*Camera) Transform

func (c *Camera) Transform(options *Options)

func (*Camera) Update

func (c *Camera) Update()

func (*Camera) WorldToScreen

func (c *Camera) WorldToScreen(x, y float64) (float64, float64)

func (*Camera) Zoom

func (c *Camera) Zoom() float64

func (*Camera) ZoomIn

func (c *Camera) ZoomIn()

func (*Camera) ZoomOut

func (c *Camera) ZoomOut()

type CameraMode

type CameraMode int
const (
	CameraModeTower CameraMode = iota
	CameraModeStack
	CameraModeSuperZoom
)

type InterpNumber

type InterpNumber struct {
	Current, Target, Speed float64
}

func (*InterpNumber) Set

func (i *InterpNumber) Set(target, speed float64)

func (*InterpNumber) Update

func (i *InterpNumber) Update() bool

type Options

type Options struct {
	Screen  *ebiten.Image
	Overlay *ebiten.Image
	VGroup  *VGroup
	Camera  *Camera
	Pitch   float64

	DrawImageOptions ebiten.DrawImageOptions

	TowerRotation float64
}

type Originable

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

func (*Originable) Origin

func (p *Originable) Origin() (float64, float64)

func (*Originable) SetOrigin

func (p *Originable) SetOrigin(x, y float64)

type Positionable

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

func (*Positionable) Position

func (p *Positionable) Position() (float64, float64)

func (*Positionable) SetPosition

func (p *Positionable) SetPosition(x, y float64)

func (*Positionable) X

func (p *Positionable) X() float64

func (*Positionable) Y

func (p *Positionable) Y() float64

type Renderable

type Renderable interface {
	Draw(*Options)
	Update()
	Position() (float64, float64)
	SetPosition(float64, float64)
	Rotation() float64
	SetRotation(float64)
	SetRotationDistance(float64)
}

type Rotateable

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

func (*Rotateable) Rotation

func (r *Rotateable) Rotation() float64

func (*Rotateable) RotationDistance

func (r *Rotateable) RotationDistance() float64

func (*Rotateable) SetRotation

func (r *Rotateable) SetRotation(rotation float64)

func (*Rotateable) SetRotationDistance

func (r *Rotateable) SetRotationDistance(rotationDistance float64)

type Sizeable

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

func (*Sizeable) Height

func (s *Sizeable) Height() float64

func (*Sizeable) SetSize

func (s *Sizeable) SetSize(width, height float64)

func (*Sizeable) Size

func (s *Sizeable) Size() (float64, float64)

func (*Sizeable) Width

func (s *Sizeable) Width() float64

type Sprite

type Sprite struct {
	Positionable
	Originable
	Rotateable

	Scale        float64
	Transparency float32
	// contains filtered or unexported fields
}

func NewSprite

func NewSprite(name string) (*Sprite, error)

func NewSpriteFromImage

func NewSpriteFromImage(image *ebiten.Image) *Sprite

func NewSpriteFromStaxie

func NewSpriteFromStaxie(name string, stackName string) (*Sprite, error)

func NewSpriteFromStaxieAnimation

func NewSpriteFromStaxieAnimation(name string, stackName string, animName string) (*Sprite, error)

func NewSubSprite

func NewSubSprite(dataSprite *Sprite, x, y, w, h int) (*Sprite, error)

func (*Sprite) Draw

func (s *Sprite) Draw(o *Options)

func (*Sprite) Height

func (s *Sprite) Height() float64

func (*Sprite) SetStaxie

func (s *Sprite) SetStaxie(name, stackName string) error

func (*Sprite) SetStaxieAnimation

func (s *Sprite) SetStaxieAnimation(name, stackName, animName string) error

func (*Sprite) Size

func (s *Sprite) Size() (float64, float64)

func (*Sprite) Update

func (s *Sprite) Update()

func (*Sprite) Width

func (s *Sprite) Width() float64

type Stack

type Stack struct {
	Positionable
	Rotateable
	Originable

	MaxSliceIndex    int
	VgroupOffset     int
	SliceOffset      int
	SliceColorOffset int
	SliceColorMin    float64
	HeightOffset     float64
	NoLighting       bool
	Transparency     float32
	ColorScale       ebiten.ColorScale
	// contains filtered or unexported fields
}

func CopyStack

func CopyStack(stack *Stack) *Stack

func NewStack

func NewStack(name string, stackName string, animationName string) (*Stack, error)

func (*Stack) Draw

func (s *Stack) Draw(o *Options)

func (*Stack) Height

func (s *Stack) Height() int

func (*Stack) SetAnimation

func (s *Stack) SetAnimation(name string) error

func (*Stack) SetFrame

func (s *Stack) SetFrame(index int) error

func (*Stack) SetOriginToCenter

func (s *Stack) SetOriginToCenter()

func (*Stack) SetStack

func (s *Stack) SetStack(name string) error

func (*Stack) SetStaxie

func (s *Stack) SetStaxie(name string) error

func (*Stack) SliceCount

func (s *Stack) SliceCount() int

func (*Stack) Stacks

func (s *Stack) Stacks() []string

func (*Stack) Update

func (s *Stack) Update()

func (*Stack) Width

func (s *Stack) Width() int

type Stacks

type Stacks []*Stack

func (*Stacks) Add

func (s *Stacks) Add(stack *Stack)

func (*Stacks) Draw

func (s *Stacks) Draw(o *Options)

func (*Stacks) Remove

func (s *Stacks) Remove(stack *Stack)

func (*Stacks) SetOrigins

func (s *Stacks) SetOrigins(x, y float64)

func (*Stacks) SetPositions

func (s *Stacks) SetPositions(x, y float64)

func (*Stacks) SetRotations

func (s *Stacks) SetRotations(r float64)

func (*Stacks) Update

func (s *Stacks) Update()

type TextDrawer

type TextDrawer struct {
	Options TextOptions
}

func NewTextDrawer

func NewTextDrawer(o TextOptions) *TextDrawer

func (*TextDrawer) Draw

func (t *TextDrawer) Draw(txt string, x, y float64)

type TextOptions

type TextOptions struct {
	Screen     *ebiten.Image
	Font       assets.Font
	Color      color.Color
	GeoM       ebiten.GeoM
	ColorScale ebiten.ColorScale
}

type VGroup

type VGroup struct {
	Positionable
	Images []*ebiten.Image
	Depth  int
	Width  int
	Height int
	Debug  bool
}

VGroup manages a slice of images intended to be rendered at offsets. This is basically an offscreen framebuffer for stack slice rendering.

func NewVGroup

func NewVGroup(w, h, n int) *VGroup

NewVGroup creates a new VGroup. Destroy() _MUST_ be called once the VGroup is no longer needed.

func (*VGroup) Clear

func (vg *VGroup) Clear()

Clear clears the internal images.

func (*VGroup) Destroy

func (vg *VGroup) Destroy()

Destroy deallocates the underlying images. This _MUST_ be called.

func (*VGroup) Draw

func (vg *VGroup) Draw(o *Options)

Draw draws the internal images to the provided screen, applying geom and otherwise.

Jump to

Keyboard shortcuts

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