Documentation ¶
Overview ¶
Package ui defines some rudimentary UI components.
Index ¶
- Constants
- type Canvas
- func (c *Canvas) Draw(mp *util.Mat4)
- func (c *Canvas) MouseDelta() (int, int)
- func (c *Canvas) MouseMove(x, y float64)
- func (c *Canvas) MousePosition() (int, int)
- func (c *Canvas) Resize(w, h int)
- func (c *Canvas) Scroll(x, y float64)
- func (c *Canvas) ScrollTo(x, y int)
- func (c *Canvas) SetPanning(v bool)
- func (c *Canvas) SetZoom(v int)
- func (c *Canvas) Viewport() (int, int)
- func (c *Canvas) Zoom() int
- type CellSelector
- func (c *CellSelector) Draw(mp *util.Mat4)
- func (c *CellSelector) HoverTarget() (int32, int32)
- func (c *CellSelector) MouseButton(button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey)
- func (c *CellSelector) MouseMove(x, y float64)
- func (c *CellSelector) Scroll(x, y float64)
- func (c *CellSelector) SelectAll()
- func (c *CellSelector) SelectionClear()
- func (c *CellSelector) SelectionDelete()
- func (c *CellSelector) SelectionMove(x, y int)
- func (c *CellSelector) SetAddSelection(v bool)
- type Clipboard
- func (c *Clipboard) ClipboardClear()
- func (c *Clipboard) ClipboardCopy()
- func (c *Clipboard) ClipboardCut()
- func (c *Clipboard) ClipboardPaste()
- func (c *Clipboard) Draw(mp *util.Mat4)
- func (c *Clipboard) MouseMove(x, y float64)
- func (c *Clipboard) Scroll(x, y float64)
- func (c *Clipboard) SetPanning(v bool)
- func (c *Clipboard) ToggleDrawClipboard()
- type Grid
- type InfoPanel
- type Window
Constants ¶
const ( ZoomMin = 1 ZoomMax = 30 ZoomDefault = 15 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Canvas ¶
type Canvas struct {
// contains filtered or unexported fields
}
Canvas facilitates panning and zooming and tracks mouse input.
func (*Canvas) MouseDelta ¶
MouseDelta returns the current mouse delta.
func (*Canvas) MousePosition ¶
MousePosition returns the current mouse position.
func (*Canvas) SetPanning ¶
SetPanning sets the panning flag. Meaning we are either dragging the scene around or not.
type CellSelector ¶
type CellSelector struct { *Grid // contains filtered or unexported fields }
CellSelector facilitates the selection of one or more cells. It maintains the current selection and provides facilities to draw the selection and the selection rectangle, if it is being drawn. It builds on the CellRenderer functionality.
func NewCellSelector ¶
func NewCellSelector() *CellSelector
NewCellSelector creates a new cell selector ontop of a cell renderer.
func (*CellSelector) Draw ¶
func (c *CellSelector) Draw(mp *util.Mat4)
func (*CellSelector) HoverTarget ¶
func (c *CellSelector) HoverTarget() (int32, int32)
HoverTarget returns the cell coordinates at the current mouse cursor position.
func (*CellSelector) MouseButton ¶
func (c *CellSelector) MouseButton(button glfw.MouseButton, action glfw.Action, mod glfw.ModifierKey)
func (*CellSelector) MouseMove ¶
func (c *CellSelector) MouseMove(x, y float64)
func (*CellSelector) Scroll ¶
func (c *CellSelector) Scroll(x, y float64)
func (*CellSelector) SelectionClear ¶
func (c *CellSelector) SelectionClear()
SelectionClear clears the current selection.
func (*CellSelector) SelectionDelete ¶
func (c *CellSelector) SelectionDelete()
SelectionDelete deletes the current selection from the simulation.
func (*CellSelector) SelectionMove ¶
func (c *CellSelector) SelectionMove(x, y int)
SelectionMove moves the currently selected area up/down, left or right by some amount of cells as denoted by x and y. These can be be negative for left/up, positive for right/down and zero to not move at all.
func (*CellSelector) SetAddSelection ¶
func (c *CellSelector) SetAddSelection(v bool)
SetAddSelection signals the type that we are adding to an existing selection instead of creating a new one.
type Clipboard ¶
type Clipboard struct { *CellSelector // contains filtered or unexported fields }
Clipboard extends a cell selector by providing clipboard functionality. It implements cut, copy and paste.
func NewClipboard ¶
func NewClipboard() *Clipboard
NewClipboard creates a new clipboard ontop of a cell selector.
func (*Clipboard) ClipboardClear ¶
func (c *Clipboard) ClipboardClear()
ClipboardClear empties the clipboard.
func (*Clipboard) ClipboardCopy ¶
func (c *Clipboard) ClipboardCopy()
ClipboardCopy copies the current cell selection to the clipboard.
func (*Clipboard) ClipboardCut ¶
func (c *Clipboard) ClipboardCut()
ClipboardCut copies the current selection to the clipboard and then deletes the selected cells from the simulation.
func (*Clipboard) ClipboardPaste ¶
func (c *Clipboard) ClipboardPaste()
ClipboardPaste pastes the current cell selection from the clipboard, to the simulation at the current cursor position.
func (*Clipboard) SetPanning ¶
func (*Clipboard) ToggleDrawClipboard ¶
func (c *Clipboard) ToggleDrawClipboard()
ToggleDrawClipboard toggles drawing of the clipboard contents.
type Grid ¶
type Grid struct { *Canvas // contains filtered or unexported fields }
Grid extends a canvas with grid rendering and snapping functionality.
func (*Grid) SetPanning ¶
func (*Grid) ToggleGridVisible ¶
ToggleGridVisible toggles visibility of the grid background. Returns the new state.
type InfoPanel ¶
type InfoPanel struct {
// contains filtered or unexported fields
}
InfoPanel defines a rectangular panel with debug information.