Documentation
¶
Overview ¶
Package render wraps the gogpu backend and provides drawing primitives used by game.
Image is CPU texture data. Frame is a per-frame command buffer consumed by the gogpu renderer. The package should draw submitted data without owning Ragnarok map, actor, input, or UI behavior.
Index ¶
- Constants
- func BitmapTextSize(text string) (int, int)
- func BitmapTextTopForCenter(containerH int) int
- func DrawActorUILabels(dst *Frame, labels []string, emblem *Image, centerX, y float64, ...)
- func DrawBitmapTextAt(dst *Frame, text string, x, y int)
- func DrawBitmapTextAtColor(dst *Frame, text string, x, y int, c color.RGBA)
- func DrawCenteredUIOutlinedTextAt(dst *Frame, text string, centerX, y float64, foreground, outline color.RGBA)
- func DrawCenteredUITextAt(dst *Frame, text string, centerX, y float64, foreground color.RGBA)
- func DrawCenteredUITextAtSize(dst *Frame, text string, centerX, y float64, foreground color.RGBA, ...)
- func DrawImageBitmapTextAtColor(dst *Image, text string, x, y int, c color.RGBA)
- func DrawImageRect(dst *Image, x, y, w, h float64, c color.Color)
- func DrawLine(dst *Frame, x0, y0, x1, y1 float64, c color.Color)
- func DrawOutlinedTextAt(dst *Frame, text string, x, y int, foreground, outline color.RGBA)
- func DrawRect(dst *Frame, x, y, w, h float64, c color.Color)
- func DrawUIOutlinedTextAt(dst *Frame, text string, x, y float64, foreground, outline color.RGBA)
- func DrawUIRect(dst *Frame, x, y, w, h float64, c color.RGBA)
- func DrawUISpeechBubble(dst *Frame, text string, centerX, bottomY, maxWidth float64)
- func DrawUITextAt(dst *Frame, text string, x, y float64, foreground color.RGBA)
- func DrawUITooltip(dst *Frame, text string, centerX, belowY, aboveY float64)
- func DrawUITooltipBox(dst *Frame, text string, centerX, belowY, aboveY, maxWidth float64, ...)
- func Run(game Game, cfg config.WindowConfig, renderCfg config.RenderConfig) error
- func SetCursorMode(mode int)
- func SetUIFont(regular, bold []byte) error
- func SnapScreenPoint(dst *Frame, x, y float64) (float64, float64)
- type Address
- type Blend
- type Camera3D
- type ColorScale
- type DrawCommand
- type DrawImageOptions
- type DrawTrianglesOptions
- type Filter
- type Fog3D
- type Frame
- func (f *Frame) BeginFrame()
- func (f *Frame) Bounds() image.Rectangle
- func (f *Frame) DrawImage(src *Image, opts *DrawImageOptions)
- func (f *Frame) DrawTriangles(vertices []Vertex, indices []uint16, texture *Image, ...)
- func (f *Frame) DrawTriangles3D(vertices []Vertex3D, indices []uint16, texture *Image, ...)
- func (f *Frame) DrawTriangles3DOwned(vertices []Vertex3D, indices []uint16, texture *Image, ...)
- func (f *Frame) DrawTrianglesOwned(vertices []Vertex, indices []uint16, texture *Image, ...)
- func (f *Frame) DrawWorldBillboard(cmd WorldBillboardCommand)
- func (f *Frame) DrawWorldMesh(mesh *WorldMesh)
- func (f *Frame) Fill(c color.Color)
- func (f *Frame) SetCamera3D(camera Camera3D)
- func (f *Frame) SetScreenScale(x, y float32)
- type Game
- type GeoM
- type Image
- func (i *Image) Bounds() image.Rectangle
- func (i *Image) DrawImage(src *Image, opts *DrawImageOptions)
- func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, texture *Image, ...)
- func (i *Image) DrawTriangles3D(vertices []Vertex3D, indices []uint16, texture *Image, ...)
- func (i *Image) DrawTriangles3DOwned(vertices []Vertex3D, indices []uint16, texture *Image, ...)
- func (i *Image) DrawTrianglesOwned(vertices []Vertex, indices []uint16, texture *Image, ...)
- func (i *Image) Fill(c color.Color)
- func (i *Image) RGBA() *image.RGBA
- type UIActorLabelCommand
- type UIRectCommand
- type UITextBoxAnchor
- type UITextBoxCommand
- type UITextLabelCommand
- type Vertex
- type Vertex3D
- type WorldBillboardCommand
- type WorldCommand
- type WorldMesh
- type WorldMeshCommand
Constants ¶
View Source
const ( CursorModeNormal = 0 CursorModeHidden = 1 )
View Source
const BackendName = "gogpu-wgpu"
Variables ¶
This section is empty.
Functions ¶
func BitmapTextSize ¶
func BitmapTextTopForCenter ¶
func DrawActorUILabels ¶
func DrawBitmapTextAt ¶
func DrawBitmapTextAtColor ¶
func DrawCenteredUITextAt ¶
func DrawCenteredUITextAtSize ¶ added in v0.8.0
func DrawOutlinedTextAt ¶
func DrawUIOutlinedTextAt ¶
func DrawUISpeechBubble ¶
func DrawUITooltip ¶
func DrawUITooltipBox ¶
func Run ¶
func Run(game Game, cfg config.WindowConfig, renderCfg config.RenderConfig) error
func SetCursorMode ¶
func SetCursorMode(mode int)
Types ¶
type ColorScale ¶
type ColorScale struct {
// contains filtered or unexported fields
}
func (*ColorScale) Scale ¶
func (c *ColorScale) Scale(r, g, b, a float32)
func (*ColorScale) ScaleAlpha ¶
func (c *ColorScale) ScaleAlpha(a float32)
type DrawCommand ¶
type DrawCommand struct {
Vertices []Vertex
Indices []uint16
Texture *Image
Options DrawTrianglesOptions
}
type DrawImageOptions ¶
type DrawImageOptions struct {
GeoM GeoM
ColorScale ColorScale
Filter Filter
Blend Blend
}
type DrawTrianglesOptions ¶
type Frame ¶
type Frame struct {
// contains filtered or unexported fields
}
Frame is the per-frame screen target. It owns draw command buffers and frame-only state; Image is only CPU texture data.
func (*Frame) BeginFrame ¶
func (f *Frame) BeginFrame()
func (*Frame) DrawImage ¶
func (f *Frame) DrawImage(src *Image, opts *DrawImageOptions)
func (*Frame) DrawTriangles ¶
func (f *Frame) DrawTriangles(vertices []Vertex, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Frame) DrawTriangles3D ¶
func (f *Frame) DrawTriangles3D(vertices []Vertex3D, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Frame) DrawTriangles3DOwned ¶
func (f *Frame) DrawTriangles3DOwned(vertices []Vertex3D, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Frame) DrawTrianglesOwned ¶
func (f *Frame) DrawTrianglesOwned(vertices []Vertex, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Frame) DrawWorldBillboard ¶
func (f *Frame) DrawWorldBillboard(cmd WorldBillboardCommand)
func (*Frame) DrawWorldMesh ¶
func (*Frame) SetCamera3D ¶
func (*Frame) SetScreenScale ¶
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func NewImageFromImage ¶
func WhiteImage ¶
func WhiteImage() *Image
func (*Image) DrawImage ¶
func (i *Image) DrawImage(src *Image, opts *DrawImageOptions)
func (*Image) DrawTriangles ¶
func (i *Image) DrawTriangles(vertices []Vertex, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Image) DrawTriangles3D ¶
func (i *Image) DrawTriangles3D(vertices []Vertex3D, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Image) DrawTriangles3DOwned ¶
func (i *Image) DrawTriangles3DOwned(vertices []Vertex3D, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
func (*Image) DrawTrianglesOwned ¶
func (i *Image) DrawTrianglesOwned(vertices []Vertex, indices []uint16, texture *Image, opts *DrawTrianglesOptions)
type UIActorLabelCommand ¶
type UIRectCommand ¶
type UITextBoxAnchor ¶
type UITextBoxAnchor int
const ( UITextBoxAnchorTopLeft UITextBoxAnchor = iota UITextBoxAnchorBottomCenter UITextBoxAnchorTooltipCenter )
type UITextBoxCommand ¶
type UITextLabelCommand ¶
type WorldBillboardCommand ¶
type WorldBillboardCommand struct {
Texture *Image
Options DrawTrianglesOptions
Center [3]float32
RightAxis [3]float32
UpAxis [3]float32
DepthUpAxis [3]float32
Width float32
Height float32
AnchorX float32
AnchorY float32
ColorR float32
ColorG float32
ColorB float32
ColorA float32
DepthBias float32
}
type WorldCommand ¶
type WorldCommand struct {
Vertices []Vertex3D
Indices []uint16
Texture *Image
LightTexture *Image
Options DrawTrianglesOptions
}
type WorldMesh ¶
type WorldMesh struct {
// contains filtered or unexported fields
}
func NewWorldMesh ¶
func NewWorldMesh(vertices []Vertex3D, indices []uint16, texture *Image, opts *DrawTrianglesOptions) *WorldMesh
func NewWorldMeshWithLightmap ¶
func NewWorldMeshWithLightmap(vertices []Vertex3D, indices []uint16, texture, lightTexture *Image, opts *DrawTrianglesOptions) *WorldMesh
func (*WorldMesh) IndexCount ¶
func (*WorldMesh) VertexCount ¶
type WorldMeshCommand ¶
type WorldMeshCommand struct {
Mesh *WorldMesh
}
Click to show internal directories.
Click to hide internal directories.