Documentation ¶
Overview ¶
Package window handles window creation, drawing and events. It uses a small subset of the features provided by the raylib library version 4.5.
Index ¶
- func DrawFPS(pt image.Point)
- type Font
- type Shader
- type Text
- type Texture
- type Window
- func (win *Window) Clear(c color.Color)
- func (*Window) Close()
- func (*Window) CursorPos() image.Point
- func (*Window) Display()
- func (win *Window) Draw(dp image.Point, src wandi.Image) error
- func (win *Window) DrawRect(dp image.Point, src wandi.Image, sr image.Rectangle) error
- func (*Window) Height() int
- func (*Window) PollEvent() we.Event
- func (*Window) SetCursorPos(pt image.Point)
- func (*Window) SetTitle(title string)
- func (*Window) ShowCursor(visible bool)
- func (*Window) Width() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Font ¶
type Font struct {
// contains filtered or unexported fields
}
A Font provides glyphs (visual characters) and metrics used for text rendering.
type Shader ¶
type Shader struct {
// contains filtered or unexported fields
}
Shader holds a vertex or fragment shader.
func LoadShader ¶
LoadShader loads the given vertex and fragment shader.
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text represent a graphical text entry with a specific font, font size, and colour. It implements the wandi.Image interface.
func NewText ¶
func NewText(args ...interface{}) *Text
NewText returns a new graphical text entry. The initial text, font, font size, and colour of the graphical text entry can be customized through string, *Font, int, and color.Color arguments respectively, depending on the type of the argument.
The default font, font size and colour of the text is default font, 12 and black, respectively.
func (*Text) SetFontSize ¶
SetFontSize sets the font size, in pixels, of the text.
type Texture ¶
type Texture struct {
// contains filtered or unexported fields
}
Texture represent a read-only texture. It implements the wandi.Image interface.
func LoadTexture ¶
LoadTexture loads the provided file and converts it into a read-only texture.
Note: a finalizer is registered to unload the texture.
func LoadTextureFromImage ¶
LoadTextureFromImage reads the provided image and converts it into a read-only texture.
Note: a finalizer is registered to unload the texture.
type Window ¶
type Window struct { }
A Window represents a graphical window capable of handling draw operations and window events. It implements the wandi.Window interface.
func Open ¶
Open opens a new window of the specified dimensions.
Note: the caller is responsible for invoking Close when finished using the window.
func (*Window) Display ¶
func (*Window) Display()
Display displays what has been rendered so far to the window.
func (*Window) Draw ¶
Draw draws the entire src image onto the window starting at the destination point dp.
func (*Window) DrawRect ¶
DrawRect draws a subset of the src image, as defined by the source rectangle sr, onto the window starting at the destination point dp.
func (*Window) PollEvent ¶
PollEvent returns a pending event from the event queue or nil if the queue was empty. Note that more than one event may be present in the event queue.
Note: the event queue is populated once per frame upon call to Window.Display.
func (*Window) SetCursorPos ¶
SetCursorPos sets the position of the cursor in the given window.
func (*Window) ShowCursor ¶
ShowCursor displays or hides the mouse cursor depending on the value of visible. It is visible by default.