camera

package
v0.0.0-...-aac1211 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cam = NewCamera(1113, 670, 0, 0, 0, 2)

Functions

This section is empty.

Types

type Animation

type Animation struct{}

func (*Animation) StartAnimation

func (a *Animation) StartAnimation(duration, delay time.Duration, maxRot, rotGap float64, cancel <-chan int)

type Camera

type Camera struct {
	X, Y, Rot, Scale, MaxScale, MinScale float64
	Width, Height                        int
	Animation
}

Camera can look at positions, zoom and rotate.

func NewCamera

func NewCamera(width, height int, x, y, rotation, zoom float64) *Camera

NewCamera returns a new Camera

func (*Camera) GetCameraOptions

func (c *Camera) GetCameraOptions() *ebiten.DrawImageOptions

Blit draws the camera's surface to the screen and applies zoom

func (*Camera) GetCameraTranslation

func (c *Camera) GetCameraTranslation() types.Vec2

func (*Camera) GetScreenCoordsTranslation

func (c *Camera) GetScreenCoordsTranslation(x, y float64) types.Vec2

func (*Camera) GetWorldCoordX

func (c *Camera) GetWorldCoordX(wc float64) float64

func (*Camera) GetWorldCoordY

func (c *Camera) GetWorldCoordY(wc float64) float64

func (*Camera) MovePosition

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

MovePosition moves the Camera by x and y. Use SetPosition if you want to set the position

func (*Camera) Resize

func (c *Camera) Resize(w, h int) *Camera

Resize resizes the camera Surface

func (*Camera) Rotate

func (c *Camera) Rotate(phi float64) *Camera

Rotate rotates by phi

func (*Camera) RunShakingLimitedAnimation

func (c *Camera) RunShakingLimitedAnimation(duration, delay time.Duration, maxRot, rotGap float64, cancel <-chan int)

func (*Camera) SetPositionX

func (c *Camera) SetPositionX(x float64) *Camera

func (*Camera) SetPositionY

func (c *Camera) SetPositionY(y float64) *Camera

func (*Camera) SetRotation

func (c *Camera) SetRotation(rot float64) *Camera

SetRotation sets the rotation to rot

func (*Camera) SetZeroPositionX

func (c *Camera) SetZeroPositionX()

func (*Camera) SetZeroPositionY

func (c *Camera) SetZeroPositionY()

func (*Camera) Zoom

func (c *Camera) Zoom(mul float64) *Camera

Zoom *= the current zoom

Jump to

Keyboard shortcuts

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