transformer

package
v0.0.0-...-b298911 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalcRenderedPos

func CalcRenderedPos(fx, fy, width, height int, mode PositionMode) (nx, ny int)

CalcRenderedPos calculates the bottom-left position to render at from the transformed position in that specified mode

func CalcRenderedPosFromRectangle

func CalcRenderedPosFromRectangle(fx, fy int, r image.Rectangle, mode PositionMode) (nx, ny int)

CalcRenderedPosFromRectangle calculates the bottom-left position to render at from the transformed position in that specified mode

func Rectangle

func Rectangle(x, y, w, h int) image.Rectangle

Rectangle creates a image.Rectangle by width/height

func RectangleFrom

func RectangleFrom(x, y int, r image.Rectangle) image.Rectangle

RectangleFrom returns a rectangle from the specified position

Types

type PositionMode

type PositionMode int
const (
	TopLeft PositionMode = iota
	TopCenter
	TopRight

	CenterLeft
	Center
	CenterRight

	BottomLeft
	BottomCenter
	BottomRight
)

type Rect

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

Rect is a image.Rectangle with the capability to translate

func NewRect

func NewRect(r image.Rectangle) *Rect

NewRect returns a new Rect

func (*Rect) Center

func (r *Rect) Center(x, y int) *Rect

Center move the center of the rect to the position

func (*Rect) Clicked

func (r *Rect) Clicked() bool

func (*Rect) ClickedBy

func (r *Rect) ClickedBy(key ebiten.MouseButton) bool

func (*Rect) Clone

func (r *Rect) Clone() *Rect

Clone returns a cloned Rect

func (*Rect) From

func (r *Rect) From(x, y int, mode PositionMode) *Rect

From move the rect to the position in the mode

func (*Rect) Hover

func (r *Rect) Hover() bool

func (*Rect) Max

func (r *Rect) Max() image.Point

Max returns the maximum position of the rectangle

func (*Rect) Min

func (r *Rect) Min() image.Point

Min returns the minimum position of the rectangle

func (*Rect) Pressed

func (r *Rect) Pressed() bool

func (*Rect) PressedBy

func (r *Rect) PressedBy(key ebiten.MouseButton) bool

func (*Rect) Size

func (r *Rect) Size() image.Point

Size returns Rectangle size

Jump to

Keyboard shortcuts

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