gfx2

package
v0.0.0-...-251eadb Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2016 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package gfx2 is the 2D graphics abstraction library

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Sheet

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

A Sheet is a collection of sprites

func NewSheet

func NewSheet(r *sdl.Renderer, imgFile string) *Sheet

NewSheet creates a new sheet given the image file

func (*Sheet) Add

func (s *Sheet) Add(r *sdl.Rect) (idx int)

Add adds specific region as a referenceable area and returns the reference ID

func (*Sheet) Copy

func (s *Sheet) Copy(r *sdl.Renderer, dest *sdl.Rect, idx int, scale int32) error

Copy copies the given reference index from the sprite sheet onto the renderer

type Sprite

type Sprite struct {
	Position sdl.Rect
	// contains filtered or unexported fields
}

A Sprite is an object represented by a texture and a position

func NewSprite

func NewSprite(pos sdl.Rect, sheet *Sheet, textureID int, scale int32) *Sprite

NewSprite creates a new sprite at the given position

func (*Sprite) Render

func (sp *Sprite) Render(r *sdl.Renderer) error

Render renders the sprite

Jump to

Keyboard shortcuts

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