object

package
v0.0.0-...-7267563 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnchorMiddle = iota
	AnchorBottomMiddle
)

Variables

View Source
var DefaultEffectSkillRangeOption = ObjectOption{
	FillColor:   color.NRGBA{144, 110, 212, 128},
	StrokeColor: color.NRGBA{144, 110, 212, 200},
	StrokeWidth: 4,
}
View Source
var DefaultNegativeSkillRangeOption = ObjectOption{
	FillColor:   color.NRGBA{235, 140, 52, 128},
	StrokeColor: color.NRGBA{235, 140, 52, 200},
	StrokeWidth: 4,
}
View Source
var DefaultPositiveSkillRangeOption = ObjectOption{
	FillColor:   color.NRGBA{102, 204, 255, 128},
	StrokeColor: color.NRGBA{102, 204, 255, 200},
	StrokeWidth: 4,
}

Functions

This section is empty.

Types

type CircleObject

type CircleObject struct {
	DefaultObject
	// contains filtered or unexported fields
}

func NewCircleObject

func NewCircleObject(opt ObjectOption, pos Vector, radius float64) *CircleObject

func (*CircleObject) IsPointInside

func (c *CircleObject) IsPointInside(v Vector) bool

type DefaultObject

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

func (*DefaultObject) CenterMatrix

func (d *DefaultObject) CenterMatrix() ebiten.GeoM

func (*DefaultObject) IsPointInside

func (d *DefaultObject) IsPointInside(v Vector) bool

func (*DefaultObject) Position

func (d *DefaultObject) Position() Vector

func (*DefaultObject) Render

func (d *DefaultObject) Render(canvas *ebiten.Image, geoM ebiten.GeoM, colorScale color.Color)

func (*DefaultObject) Rotate

func (d *DefaultObject) Rotate(r float64) Object

func (*DefaultObject) Scale

func (d *DefaultObject) Scale(v float64) Object

func (*DefaultObject) Translate

func (d *DefaultObject) Translate(v Vector) Object

func (*DefaultObject) UpdatePosition

func (d *DefaultObject) UpdatePosition(v Vector)

func (*DefaultObject) UpdateRotate

func (d *DefaultObject) UpdateRotate(r float64)

type FanObject

type FanObject struct {
	DefaultObject
	// contains filtered or unexported fields
}

func NewFanObject

func NewFanObject(opt ObjectOption, pos Vector, angle, length float64) *FanObject

func (*FanObject) IsPointInside

func (f *FanObject) IsPointInside(v Vector) bool

type Object

type Object interface {
	Position() Vector
	UpdatePosition(v Vector)
	// Rotate rotates the Object by given angle in radian, and anchor is defined by the need of game (Position point).
	// For example, circle object rotates around its center, but rectangle object rotates around its width center.
	// if you want to rotate the object around a self-defined point, you need to translate the object first.
	Rotate(r float64) Object
	UpdateRotate(r float64)
	Translate(v Vector) Object
	Scale(s float64) Object
	IsPointInside(v Vector) bool
	Render(canvas *ebiten.Image, geoM ebiten.GeoM, colorScale color.Color)
}

type ObjectOption

type ObjectOption struct {
	FillColor   color.NRGBA
	StrokeColor color.NRGBA
	StrokeWidth float64
}

type PointObject

type PointObject struct {
	DefaultObject
}

PointObject is a simple object that has only position, used for player and enemy position. It implements Object interface, but it does not have any effect on RotateBy and Scale.

func NewPointObject

func NewPointObject(pos Vector) *PointObject

func (*PointObject) IsPointInside

func (p *PointObject) IsPointInside(v Vector) bool

type RectObject

type RectObject struct {
	DefaultObject
	// contains filtered or unexported fields
}

func NewRectObject

func NewRectObject(opt ObjectOption, pos Vector, anchor int, rw, rh float64) *RectObject

NewRectObject creates a new RectObject with given position and size.

func (*RectObject) IsPointInside

func (r *RectObject) IsPointInside(v Vector) bool

type RingObject

type RingObject struct {
	DefaultObject
	// contains filtered or unexported fields
}

func NewRingObject

func NewRingObject(opt ObjectOption, pos Vector, innerRadius float64, outerRadius float64) *RingObject

func (*RingObject) IsPointInside

func (r *RingObject) IsPointInside(v Vector) bool

Jump to

Keyboard shortcuts

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