graphics

package
v0.0.0-...-4142f2f Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package graphics provides functionality for 2D graphics rendering, including textures, sprites, text, and shapes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CubeFace

type CubeFace int
const (
	CubeFront CubeFace = iota
	CubeBack
	CubeLeft
	CubeRight
	CubeTop
	CubeBottom
)

type EventManager

type EventManager interface {
	PollEvents() bool
}

type GraphicsBackend

type GraphicsBackend interface {
	Close()
	GetScreenSize() (int, int)
	SetScreenSize(width int, height int)

	WindowManager
	EventManager
	Renderer
	TextureManager
	ShapeRenderer
	InputManager
}

type InputManager

type InputManager interface {
	SetInputCallback(fn func(eventChan chan input.Event))
}

type Renderable

type Renderable interface {
	RenderPass(pass *wgpu.RenderPassEncoder)
	Render()
	Dispose()
	IsDisposed() bool
	Hide()
}

type Renderer

type Renderer interface {
	Clear(c color.Color)
	Render()
}

type Shape

type Shape interface {
	Renderable
	Transformable
	SetColor(c color.Color)
}

type ShapeRenderer

type ShapeRenderer interface {
	AddPolygon(cx, cy int, width float32, c color.Color, sides int) Shape
	AddTriangle(x1, y1, x2, y2, x3, y3 int, c color.Color) Shape
	AddRectangle(x, y, width, height int, c color.Color) Shape
	AddCircle(cx, cy int, radius float32, c color.Color, segments int) Shape
	AddLine(x1, y1, x2, y2 int, width float32, c color.Color) Shape
}

type Texture

type Texture interface {
	Handle() uintptr
	UpdateImage(img image.Image) error
	SetShouldBeRendered(souldRender bool)
	Resize(width, height float32)
	Move(x, y float32)
	Rotate(a, pivotX, pivotY float32)
	Scale(x, y float32)
	FlipVertical()
	FlipHorizontal()
	Clip(minX, minY, maxX, maxY float32)
	RenderPass(pass *wgpu.RenderPassEncoder)
	Render()
	Dispose()
	IsDisposed() bool
}

type TextureManager

type TextureManager interface {
	CreateTextureFromImage(img image.Image) (Texture, error)
	UpdateTextureFromImage(texture Texture, img image.Image)
	DisposeTexture(h uintptr)
}

type Transformable

type Transformable interface {
	Move(screenX, screenY float32)
	Rotate(angle float32) matrix.Matrix
	Scale(sx, sy float32) matrix.Matrix
}

type WindowManager

type WindowManager interface {
	SetWindowTitle(title string)
	DestroyWindow()
	SetWindowSize(width int, height int)
	GetWindowSize() (int, int)
	GetWindowPosition() (x int, y int)
	IsDisposed() bool
	Renderer
}

Directories

Path Synopsis
internal/surface
The surface package provides a virtual screen to render things to.
The surface package provides a virtual screen to render things to.

Jump to

Keyboard shortcuts

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