Documentation ¶
Overview ¶
The surface package provides a virtual screen to render things to.
Index ¶
- type RenderQueue
- func (rq *RenderQueue) AddCircle(cx, cy int, radius float32, c color.Color, segments int) graphics.Shape
- func (rq *RenderQueue) AddLine(x1, y1, x2, y2 int, width float32, c color.Color) graphics.Shape
- func (rq *RenderQueue) AddPolygon(cx, cy int, width float32, c color.Color, sides int) graphics.Shape
- func (rq *RenderQueue) AddRectangle(x, y, width, height int, c color.Color) graphics.Shape
- func (rq *RenderQueue) AddToRenderQueue(r graphics.Renderable)
- func (rq *RenderQueue) AddTriangle(x1, y1, x2, y2, x3, y3 int, c color.Color) graphics.Shape
- func (rq *RenderQueue) CreateTextureFromImage(img image.Image) (graphics.Texture, error)
- func (rq *RenderQueue) DisposeTexture(h uintptr)
- func (rq *RenderQueue) Pop() (graphics.Renderable, bool)
- func (rq *RenderQueue) PrepareFrame()
- func (rq *RenderQueue) RenderClear()
- func (rq *RenderQueue) RenderFrame(pass *wgpu.RenderPassEncoder)
- func (rq *RenderQueue) UpdateTextureFromImage(texture graphics.Texture, img image.Image)
- type Surface
- type Texture
- func (t *Texture) Clip(minX, minY, maxX, maxY float32)
- func (t *Texture) Dispose()
- func (t *Texture) FlipHorizontal()
- func (t *Texture) FlipVertical()
- func (t *Texture) Handle() uintptr
- func (t *Texture) Hide()
- func (t *Texture) IsDisposed() bool
- func (t *Texture) Move(x, y float32)
- func (t *Texture) Render()
- func (t *Texture) RenderPass(pass *wgpu.RenderPassEncoder)
- func (t *Texture) Resize(width, height float32)
- func (t *Texture) Rotate(a, pivotX, pivotY float32)
- func (t *Texture) Scale(x, y float32)
- func (t *Texture) SetHandle(h textureHandle)
- func (t *Texture) SetShouldBeRendered(shouldRender bool)
- func (t *Texture) UpdateImage(img image.Image) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RenderQueue ¶
type RenderQueue struct { *wgpu.Device *wgpu.SwapChainDescriptor Textures map[textureHandle]*Texture // contains filtered or unexported fields }
func NewRenderQueue ¶
func NewRenderQueue(surface *Surface, d *wgpu.Device, scd *wgpu.SwapChainDescriptor) *RenderQueue
func (*RenderQueue) AddCircle ¶
func (rq *RenderQueue) AddCircle(cx, cy int, radius float32, c color.Color, segments int) graphics.Shape
AddCircle creates a new Circle renderable and adds it to the RenderQueue. It returns a reference to the created Circle.
func (*RenderQueue) AddLine ¶
AddLine creates a new Line renderable and adds it to the RenderQueue. It returns a reference to the created Line.
func (*RenderQueue) AddPolygon ¶
func (rq *RenderQueue) AddPolygon(cx, cy int, width float32, c color.Color, sides int) graphics.Shape
AddPolygon creates a new Polygon renderable and adds it to the RenderQueue. It returns a reference to the created Polygon.
func (*RenderQueue) AddRectangle ¶
AddRectangle creates a new Rectangle renderable and adds it to the RenderQueue. It returns a reference to the created Rectangle.
func (*RenderQueue) AddToRenderQueue ¶
func (rq *RenderQueue) AddToRenderQueue(r graphics.Renderable)
func (*RenderQueue) AddTriangle ¶
AddTriangle creates a new Triangle renderable and adds it to the RenderQueue. It returns a reference to the created Triangle.
func (*RenderQueue) CreateTextureFromImage ¶
func (*RenderQueue) DisposeTexture ¶
func (rq *RenderQueue) DisposeTexture(h uintptr)
func (*RenderQueue) Pop ¶
func (rq *RenderQueue) Pop() (graphics.Renderable, bool)
func (*RenderQueue) PrepareFrame ¶
func (rq *RenderQueue) PrepareFrame()
func (*RenderQueue) RenderClear ¶
func (rq *RenderQueue) RenderClear()
func (*RenderQueue) RenderFrame ¶
func (rq *RenderQueue) RenderFrame(pass *wgpu.RenderPassEncoder)
func (*RenderQueue) UpdateTextureFromImage ¶
func (rq *RenderQueue) UpdateTextureFromImage(texture graphics.Texture, img image.Image)
type Surface ¶
type Surface struct { *gpu.Renderer *RenderQueue Width int Height int }
func (*Surface) GetScreenSize ¶
func (*Surface) GetSurfaceSize ¶
func (*Surface) SetScreenSize ¶
func (*Surface) SetSurfaceSize ¶
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
func NewTexture ¶
func NewTexture(surface *Surface, d *wgpu.Device, scd *wgpu.SwapChainDescriptor, img image.Image, renderQueue *RenderQueue) *Texture
func (*Texture) FlipHorizontal ¶
func (t *Texture) FlipHorizontal()
func (*Texture) FlipVertical ¶
func (t *Texture) FlipVertical()
func (*Texture) IsDisposed ¶
func (*Texture) RenderPass ¶
func (t *Texture) RenderPass(pass *wgpu.RenderPassEncoder)