Documentation
¶
Overview ¶
A simple 2D graphics library
Index ¶
- Variables
- func AddFileSystem(efs fs.FS)
- func ClearBackground(r, g, b, a uint8)
- func DrawRectangle(x, y, width, height float64)
- func DrawText(font Font, text string, x, y float64, size int)
- func DrawTexture2f(texture Texture, dx, dy float64)
- func DrawTexture4f(texture Texture, dx, dy, dWidth, dHeight float64)
- func DrawTexture8f(texture Texture, dx, dy, dWidth, dHeight, sx, sy, sWidth, sHeight float64)
- func SetAnimationLoop(animate func())
- func SetTintColor(r, g, b, a uint8)
- func SetTransform(a, b, c, d, e, f float64)
- type Font
- type Texture
Constants ¶
This section is empty.
Variables ¶
var DeltaTime float64
milliseconds it took to draw last frame
var Height float64
clientHeight of the canvas
var MouseButtons int
buttons being pressed (if any)
var MouseX float64
X coordinate of the mouse pointer
var MouseY float64
Y coordinate of the mouse pointer
var Width float64
clientWidth of the canvas
Functions ¶
func AddFileSystem ¶
Copy embed.FS to wasm memory. This must be called before loading assets pass it an embed.FS
func ClearBackground ¶
func ClearBackground(r, g, b, a uint8)
Clears the background with color specified by red, green, blue and alpha channel values between 0 and 255.
func DrawTexture2f ¶
Draws a texture onto the canvas where dx and dy specify the coordinates of the top-left corner.
func DrawTexture4f ¶
Draws a texture of width dWidth and height dHeight onto the canvas where dx and dy specify the coordinates of the top-left corner.
func DrawTexture8f ¶
Draws a texture of width dWidth and height dHeight onto the canvas where dx and dy specify the coordinates of the top-left corner and parameters sx, sy, sWidth and sHeight define a texture subsection to read from.
func SetAnimationLoop ¶
func SetAnimationLoop(animate func())
Sets the function to call when it's time to update your animation for the next repaint
func SetTintColor ¶
func SetTintColor(r, g, b, a uint8)
Sets the color to tint textures with specified by red, green, blue and alpha channel values between 0 and 255.
func SetTransform ¶
func SetTransform(a, b, c, d, e, f float64)
Sets the matrix to transform all following instances by.
Types ¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
astar
command
|
|
|
bouncing-dvd-logo
command
|
|
|
bunnymark
command
|
|
|
isometric-cube
command
|
|
|
internal
|
|