shapes

package
v0.0.0-...-cddb420 Latest Latest
Warning

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

Go to latest
Published: May 29, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PointLen    = 3
	ColourLen   = 4
	TexCoordLen = 2

	PointSize    = PointLen * float32Size
	ColourSize   = ColourLen * float32Size
	TexCoordSize = TexCoordLen * float32Size

	VertexSize = PointSize + ColourSize + TexCoordSize
)
View Source
const (
	NumVertices = 4
)

Variables

This section is empty.

Functions

func LoadImage

func LoadImage(filename string, imageChan chan ImageMessage)

Types

type Colour

type Colour struct {
	R float32
	G float32
	B float32
	A float32
}

type ImageMessage

type ImageMessage struct {
	Filename string
	Rgba     *image.RGBA
}

type Point

type Point struct {
	X float32
	Y float32
	Z float32
}

type Rectangle

type Rectangle struct {
	Handle uint32
	// contains filtered or unexported fields
}

func NewRectangle

func NewRectangle(x, y float32, width, height int) *Rectangle

func (*Rectangle) ClickInRect

func (r *Rectangle) ClickInRect(x, y float32) bool

func (*Rectangle) Draw

func (r *Rectangle) Draw(program uint32)

func (*Rectangle) MakeVao

func (r *Rectangle) MakeVao() uint32

func (*Rectangle) Pos

func (r *Rectangle) Pos() (float32, float32)

func (*Rectangle) RequestTexture

func (r *Rectangle) RequestTexture(filename string, imageChan chan ImageMessage)

func (*Rectangle) Scale

func (r *Rectangle) Scale(scale float32)

func (*Rectangle) SetDefaultTexture

func (r *Rectangle) SetDefaultTexture()

func (*Rectangle) SetTexCoords

func (r *Rectangle) SetTexCoords(texture *Texture)

func (*Rectangle) Size

func (r *Rectangle) Size() (int, int)

func (*Rectangle) UpdateXPos

func (r *Rectangle) UpdateXPos(dx float32)

func (*Rectangle) UpdateYPos

func (r *Rectangle) UpdateYPos(dy float32)

type TexCoord

type TexCoord struct {
	S float32
	T float32
}

type Texture

type Texture struct {
	Handle    uint32
	Width     int
	Height    int
	TexCoords []TexCoord
}
var (
	DefaultTexture *Texture
)

func CreateTextureFromImageRgba

func CreateTextureFromImageRgba(rgba *image.RGBA) *Texture

func NewTexture

func NewTexture(filename string, imageChan chan ImageMessage) (*Texture, error)

func (*Texture) SetTexCoords

func (t *Texture) SetTexCoords(containerWidth, containerHeight int)

type Vertex

type Vertex struct {
	Point    Point
	Colour   Colour
	TexCoord TexCoord
}

Jump to

Keyboard shortcuts

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