Documentation ¶
Index ¶
- func Clear(c color.RGBA)
- func Close()
- func CompileShader(shaderCode string) int
- func CreateRenderQueue() graphics.RenderQueue
- func DisableFPS()
- func DisableWindowResize()
- func EnableFPS()
- func GetCursorPosition() (int, int)
- func GetFPS() float64
- func GetScreenSize() (int, int)
- func GetWindowHeight() int
- func GetWindowPosition() (int, int)
- func GetWindowSize() (int, int)
- func GetWindowWidth() int
- func IsButtonJustPressed(buttonCode input.MouseButton) bool
- func IsButtonPressed(buttonCode input.MouseButton) bool
- func IsKeyJustPressed(keyCode input.Key) bool
- func IsKeyPressed(keyCode input.Key) bool
- func PressButton(buttonCode input.MouseButton)
- func PressKey(keyCode input.Key)
- func PrintAt(s string, x int, y int, c color.Color)deprecated
- func ReleaseButton(buttonCode input.MouseButton)
- func ReleaseKey(keyCode input.Key)
- func Run(updateFn func(), renderFn func())
- func RunApp(game Game)
- func RunGame(game Game)
- func SetBorderlessWindowed(v bool)
- func SetScreenSize(width, height int)
- func SetScrollCallback(cb func(x float64, y float64))
- func SetTitle(title string)
- func SetWindowSize(width, height int)
- func SubmitDrawBuffer(vertices []gui.Vertex)
- type Game
- type Renderable
- type Shape
- func Circle(x, y int, radius float32, c color.Color) Shape
- func Line(x1, y1, x2, y2 int, width float32, c color.Color) Shape
- func Polygon(x, y int, width float32, sides int, c color.Color) Shape
- func PolygonFromVertices(x, y int, width float32, vertices []Vertex) Shape
- func Rectangle(x, y, width, height int, c color.Color) Shape
- func Triangle(x1, y1, x2, y2, x3, y3 int, c color.Color) Shape
- type Sprite
- type Texture
- type Uniform
- type Vertex
- type VertexAttributeLayout
- type VertexBufferLayout
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CompileShader ¶
CompileShader takes wgsl shader code as an argument and returns a hash that can be used internally to reference a shader
func CreateRenderQueue ¶
func CreateRenderQueue() graphics.RenderQueue
func DisableWindowResize ¶
func DisableWindowResize()
func GetCursorPosition ¶
func GetScreenSize ¶
func GetWindowHeight ¶
func GetWindowHeight() int
func GetWindowPosition ¶
func GetWindowSize ¶
GetWindowSize retrieves the current window size.
func GetWindowWidth ¶
func GetWindowWidth() int
func IsButtonJustPressed ¶
func IsButtonJustPressed(buttonCode input.MouseButton) bool
IsButtonJustPressed checks if a mouse button was just pressed
func IsButtonPressed ¶
func IsButtonPressed(buttonCode input.MouseButton) bool
func IsKeyJustPressed ¶
func IsKeyPressed ¶
IsKeyPressed checks if a key is currently pressed
func PressButton ¶
func PressButton(buttonCode input.MouseButton)
PressButton simulates a mouse button press
func PrintAt
deprecated
PrintAt renders text at a specified position with a specified color. s is the string to be rendered. x, y define the position where the text will be rendered. c specifies the color of the text.
Deprecated: the original implementation of this was inefficient... TODO: fix this
func ReleaseButton ¶
func ReleaseButton(buttonCode input.MouseButton)
func ReleaseKey ¶
func Run ¶
func Run(updateFn func(), renderFn func())
Run is the main update function called to refresh the engine state.
func SetBorderlessWindowed ¶
func SetBorderlessWindowed(v bool)
func SetScreenSize ¶
func SetScreenSize(width, height int)
SetScreenSize sets the size of the screen.
func SetScrollCallback ¶
func SetWindowSize ¶
func SetWindowSize(width, height int)
SetWindowSize sets the size of the window.
func SubmitDrawBuffer ¶
Types ¶
type Renderable ¶
type Renderable graphics.ShaderRenderable
func CreateRenderable ¶
func CreateRenderable(shaderHandle int, vertexData []byte, layout VertexBufferLayout, uniforms map[string]Uniform, dataMap map[string][]byte) Renderable
CreateRenderable creates a `graphics.ShaderRenderable` with the provided shader handle, uniforms, and vertices.
type Shape ¶
func Circle ¶
Circle creates a circle shape with specified center, radius, and color. x, y define the center of the circle. radius defines the radius of the circle. c specifies the color of the circle.
func Line ¶
Line creates a line with specified start and end points, width, and color. x1, y1 define the start point of the line. x2, y2 define the end point of the line. width defines the thickness of the line. c specifies the color of the line.
func Polygon ¶
Polygon creates a polygon shape with a specified number of sides, position, width, and color. x, y define the center of the polygon. width defines the diameter of the circumcircle of the polygon. sides specify the number of sides (vertices) of the polygon. c specifies the color of the polygon.
func PolygonFromVertices ¶
PolygonFromVertices creates a polygon shape using a specified array of vertices. The vertices should be defined with their positions and colors. The function converts the input vertices from the local Vertex type to the graphics.Vertex type required by the graphics backend. The created polygon is then added to the render queue.
Parameters:
- x, y: The x and y coordinates of the polygon's position.
- width: The width of the polygon (not used directly in this function, included for interface consistency).
- vertices: A slice of Vertex that defines the positions and colors of the polygon's vertices.
Returns:
- A graphics.Shape that represents the created polygon.
type Texture ¶
func CreateTexture ¶
type Vertex ¶
func ConvertVerticesToNDC2D ¶
type VertexAttributeLayout ¶
type VertexBufferLayout ¶
type VertexBufferLayout struct { ArrayStride uint64 Attributes []VertexAttributeLayout }
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
Package graphics provides functionality for 2D graphics rendering, including textures, sprites, text, and shapes.
|
Package graphics provides functionality for 2D graphics rendering, including textures, sprites, text, and shapes. |
pkg
|
|
component
The component package has some basic structs that are common in games (e.g.
|
The component package has some basic structs that are common in games (e.g. |
draw
draw is a package from drawing with the cpu
|
draw is a package from drawing with the cpu |
fb
The fb package provides a framebuffer abstraction.
|
The fb package provides a framebuffer abstraction. |
grugui
grugui draws directly to textures.
|
grugui draws directly to textures. |
grugui/renderer
grugRenderer draws to textures.
|
grugRenderer draws to textures. |
math/geom
The geom package provides basic geometry types and functions.
|
The geom package provides basic geometry types and functions. |