g4

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

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

Go to latest
Published: Jul 1, 2016 License: MIT Imports: 15 Imported by: 1

README

go-g4

Rendering functions for Rectangles, Fonts, Canvas, Transparencies

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear(red, green, blue, alpha float32)

func ClearRect

func ClearRect(width, height int,
	red, green, blue float32)

func DrawCanvasRect

func DrawCanvasRect(canvas *Canvas,
	left, top, width, height int,
	alphas []float32)

func DrawColorRect

func DrawColorRect(left, top, width, height int,
	leftTopColor []float32,
	rightTopColor []float32,
	rightBottomColor []float32,
	leftBottomColor []float32)

func DrawStringRect

func DrawStringRect(fontTexture *StringTexture,
	left, top int,
	rgbFg []float32,
	rgbBg []float32,
	alpha float32)

func DrawTextureRect

func DrawTextureRect(texture *Texture,
	left, top, width, height int,
	alphas []float32)

func DrawTextureRectUpsideDown

func DrawTextureRectUpsideDown(texture *Texture,
	left, top, width, height int,
	alphas []float32)

func Init

func Init()

func LoadTrueTypeFromFile

func LoadTrueTypeFromFile(fontFilename string) *truetype.Font

func PopOrtho

func PopOrtho()

func PopView

func PopView()

func PopViewport

func PopViewport()

func PushOrtho

func PushOrtho(width, height int)

func PushView

func PushView(width, height int)

func PushViewport

func PushViewport(width, height int)

func Uninit

func Uninit()

Types

type Canvas

type Canvas struct {
	Framebuffer   *FrameBuffer
	Width, Height int
}

func NewCanvas

func NewCanvas(width, height int) *Canvas

func (*Canvas) Begin

func (c *Canvas) Begin()

func (*Canvas) Clear

func (c *Canvas) Clear(red, green, blue float32)

func (*Canvas) End

func (c *Canvas) End()

func (*Canvas) Free

func (c *Canvas) Free()

func (*Canvas) Paint

func (c *Canvas) Paint(seeThru bool, left, top int, alphas []float32)

type ColorRect

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

func NewColorRect

func NewColorRect() *ColorRect

func (*ColorRect) Draw

func (r *ColorRect) Draw(left, top, width, height int,
	leftTopColor []float32,
	rightTopColor []float32,
	rightBottomColor []float32,
	leftBottomColor []float32,
	projection *float32)

func (*ColorRect) DrawSolid

func (r *ColorRect) DrawSolid(left, top, width, height int,
	red, green, blue float32,
	projection *float32)

func (*ColorRect) Free

func (r *ColorRect) Free()

type FrameBuffer

type FrameBuffer struct {
	Texture *Texture

	FramebufferId uint32
}

func NewFrameBuffer

func NewFrameBuffer(width, height int) *FrameBuffer

func (*FrameBuffer) Begin

func (f *FrameBuffer) Begin()

func (*FrameBuffer) End

func (f *FrameBuffer) End()

func (*FrameBuffer) Free

func (f *FrameBuffer) Free()

type G4Font

type G4Font struct {
	Face    *font.Face
	Height  int
	Ascent  int
	Descent int
}

func NewG4Font

func NewG4Font(f *truetype.Font, fontSize int) *G4Font

func (*G4Font) Free

func (f *G4Font) Free()

func (*G4Font) Width

func (f *G4Font) Width(str string) int

type StringTexture

type StringTexture struct {
	String  string
	Texture *Texture
}

func NewStringTexture

func NewStringTexture(str string, aceFont *G4Font) *StringTexture

func (*StringTexture) Free

func (s *StringTexture) Free()

type Texture

type Texture struct {
	TextureId uint32

	Width, Height int
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture() *Texture

func (*Texture) Activate

func (t *Texture) Activate(texUnit uint32)

func (*Texture) Allocate

func (t *Texture) Allocate(width, height int)

func (*Texture) Deactivate

func (t *Texture) Deactivate()

func (*Texture) Free

func (t *Texture) Free()

func (*Texture) LoadBytes_RGBA

func (t *Texture) LoadBytes_RGBA(width, height int, bytes []uint8)

func (*Texture) LoadImage

func (t *Texture) LoadImage(filename string)

type TextureRect

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

func NewTextureRect

func NewTextureRect(vertexShaderFilename, fragmentShaderFilename string) *TextureRect

func (*TextureRect) Draw

func (r *TextureRect) Draw(texture *Texture,
	left, top, width, height int,
	leftTopRightBottomAlphas []float32,
	projection *float32)

func (*TextureRect) DrawString

func (r *TextureRect) DrawString(texture *Texture,
	left, top, width, height int,
	rgbFg []float32,
	rgbBg []float32,
	alpha float32,
	projection *float32)

func (*TextureRect) DrawUpsideDown

func (r *TextureRect) DrawUpsideDown(texture *Texture,
	left, top, width, height int,
	leftTopRightBottomAlphas []float32,
	projection *float32)

func (*TextureRect) Free

func (r *TextureRect) Free()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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