camera

package module
v0.0.0-...-d16bc86 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 1 Imported by: 2

README

ebiten-camera

A simple camera library for ebiten

Usage

import camera "github.com/tducasse/ebiten-camera"

myCamera := camera.Init(screenWidth, screenHeight)
world := ebiten.NewImage(worldWidth, worldHeight)

ebiten.SetWindowSize(screenWidth*windowScale, screenHeight*windowScale)

// in your Draw call
world.Clear()
// your draw calls go here, but target world instead of screen
player.Draw(world)
// then draw the world onto the screen
myCamera.Draw(world, screen)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Camera

type Camera struct {
	Width  int
	Height int
	X      float64
	Y      float64
	Follow *FollowData
}

func Init

func Init(width int, height int) *Camera

func (*Camera) Draw

func (c *Camera) Draw(world *ebiten.Image, screen *ebiten.Image)

func (*Camera) GetTransform

func (c *Camera) GetTransform() ebiten.GeoM

type FollowData

type FollowData struct {
	W int
	H int
}

Jump to

Keyboard shortcuts

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