Documentation ¶
Overview ¶
Package window handles window creation, drawing and events. It uses a small subset of the features provided by the SFML library version 2.5 1.
Index ¶
- type Style
- type Window
- func (win *Window) Close()
- func (win *Window) CursorPos() image.Point
- func (win *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 (win *Window) Fill(c color.Color)
- func (win *Window) GrabCursor(grab bool)
- func (win *Window) Height() int
- func (win Window) PollEvent() we.Event
- func (win *Window) SetActive()
- func (win *Window) SetCursorPos(pt image.Point)
- func (win *Window) SetTitle(title string)
- func (win *Window) ShowCursor(visible bool)
- func (win *Window) Width() int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
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. An optional window style may be provided. By default the window is resizeable and not in full screen mode.
Note: The main thread must be used for both window creation and event handling. It is perfectly fine to use separate threads for rendering and event handling, as long as all event handling takes place in the main thread.
Note: The Close method of the window must be called when finished using it.
func (*Window) Display ¶
func (win *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) GrabCursor ¶
GrabCursor specifies whether to grab the mouse cursor within the given window.
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 main thread must be used for both window creation and event handling. It is perfectly fine to use separate threads for rendering and event handling, as long as all event handling takes place in the main thread.
Note: Some internal window events of SFML depend on calls to PollEvent to take effect. For instance a call to SetTitle will not update the window title until the next call of PollEvent.
func (*Window) SetActive ¶
func (win *Window) SetActive()
SetActive activates the CPU context of the window.
func (*Window) SetCursorPos ¶
SetCursorPos sets the position of the cursor in the given window.
func (*Window) SetTitle ¶
SetTitle sets the title of the window.
Note: The title will be updated on the next call to PollEvent.
func (*Window) ShowCursor ¶
ShowCursor displays or hides the mouse cursor depending on the value of visible. It is visible by default.