sprite

package
v0.0.0-...-1c1542d Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetClosestColor

func GetClosestColor(color rl.Color) int

GetClosestColor returns the closest color in the pallet to the given color.

Types

type Sprite

type Sprite struct {
	Pixels []int
	Width  int
	Height int
}

func LoadFromImage

func LoadFromImage(path string) *Sprite

LoadFromImage loads a sprite from an image by the filepath.

func NewSprite

func NewSprite(width, height int) *Sprite

NewSprite creates a new sprite with the given width and height.

func (*Sprite) Crop

func (s *Sprite) Crop(x, y, width, height int) *Sprite

Crop crops the sprite with the given x, y, width, and height. returns a new sprite.

func (*Sprite) GetPixel

func (s *Sprite) GetPixel(x, y int) int

GetPixel returns the color ID of a pixel in the sprite.

func (*Sprite) SetPixel

func (s *Sprite) SetPixel(x, y, colorID int)

SetPixel sets the color ID of a pixel in the sprite.

Jump to

Keyboard shortcuts

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