rescaler

package module
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

README

rescaler

The rescaler component enables scenes to define their elements at a given resolution and have those elements repositioned and rescaled to accomodate different resolutions.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BtnOption

func BtnOption(rsc *Rescaler) btn.Option

BtnOption can be used with an x/btn option set to apply most operations a rescaler provides where meaningful.

Types

type Rescaler

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

A Rescaler knows the resolution a scene is designed for, and can make simple adjustments to scale and positioning of elements in the scene if the window is scaled differently from the target resolution at scene start. The rescaler does not handle a window's size changing mid-scene.

func New

func New(ctx *scene.Context, targetResolution intgeom.Point2) *Rescaler

New should take in the resolution the scene's elements are all designed for.

func (Rescaler) Dims

func (rsc Rescaler) Dims(dims floatgeom.Point2) floatgeom.Point2

func (Rescaler) Draw

func (rs Rescaler) Draw(r render.Renderable, layers ...int)

func (Rescaler) Height

func (rsc Rescaler) Height(h float64) float64

func (Rescaler) Position

func (rsc Rescaler) Position(target floatgeom.Point2) (float64, float64)

func (Rescaler) Scale

func (rsc Rescaler) Scale(m render.Modifiable)

Scale will scale a modifiable

func (Rescaler) SetPosition

func (rsc Rescaler) SetPosition(rnd render.Renderable, target floatgeom.Point2)

func (Rescaler) Width

func (rsc Rescaler) Width(w float64) float64

Jump to

Keyboard shortcuts

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