Documentation
¶
Overview ¶
Toolkit package for Mural GUI.
Index ¶
- Constants
- func Atlas(f *font.Face) *text.Atlas
- func BottomOf(drawArea pixel.Rect, size pixel.Vec, offset float64) pixel.Vec
- func ConvSize(size1080p float64) float64
- func ConvVec(vec1080p pixel.Vec) pixel.Vec
- func DisBL(rect pixel.Rect, scale float64) pixel.Vec
- func DisBR(rect pixel.Rect, scale float64) pixel.Vec
- func DisTL(rect pixel.Rect, scale float64) pixel.Vec
- func DisTR(rect pixel.Rect, scale float64) pixel.Vec
- func DrawPosBC(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosBL(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosBR(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosCL(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosCR(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosTC(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosTL(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawPosTR(bg pixel.Rect, size pixel.Vec) pixel.Vec
- func DrawRect(t pixel.Target, drawArea pixel.Rect, color color.Color)
- func InitAudio(format beep.Format) error
- func LeftOf(drawArea pixel.Rect, size pixel.Vec, offset float64) pixel.Vec
- func MainFont(s Size) font.Face
- func Matrix() pixel.Matrix
- func MatrixToDrawArea(matrix pixel.Matrix, rectSize pixel.Vec) (drawArea pixel.Rect)
- func MoveBC(bgSize, obSize pixel.Vec) pixel.Vec
- func MoveBL(bgSize, obSize pixel.Vec) pixel.Vec
- func MoveBR(bgSize, obSize pixel.Vec) pixel.Vec
- func MoveTC(bgSize, obSize pixel.Vec) pixel.Vec
- func MoveTL(bgSize, obSize pixel.Vec) pixel.Vec
- func MoveTR(bgSize, obSize pixel.Vec) pixel.Vec
- func PosBL(size pixel.Rect, pos pixel.Vec) pixel.Vec
- func PosBR(size pixel.Rect, pos pixel.Vec) pixel.Vec
- func PosTL(size pixel.Rect, pos pixel.Vec) pixel.Vec
- func PosTR(size, pos pixel.Vec) pixel.Vec
- func Range(from, to pixel.Vec) float64
- func RightOf(drawArea pixel.Rect, size pixel.Vec, offset float64) pixel.Vec
- func Scale() float64
- func SetButtonClickSound(s *beep.Buffer)
- func SetMainFont(font *truetype.Font)
- func SlotCopy(slotA, slotB *Slot)
- func SlotSwitch(slotA, slotB *Slot)
- func SplitSubN(s string, n int) []string
- func TopOf(drawArea pixel.Rect, size pixel.Vec, offset float64) pixel.Vec
- type Align
- type Animation
- func (anim *Animation) Draw(t pixel.Target, matrix pixel.Matrix)
- func (anim *Animation) DrawArea() pixel.Rect
- func (anim *Animation) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color)
- func (anim *Animation) Finished() bool
- func (anim *Animation) Loop(loop bool)
- func (anim *Animation) Restart()
- func (anim *Animation) SetCurrentFrameID(id int)
- func (anim *Animation) SetFPS(fps int)
- func (anim *Animation) Update(win *Window)
- type AudioPlayer
- func (ap *AudioPlayer) AddAudio(ab *beep.Buffer) error
- func (ap *AudioPlayer) Clear()
- func (ap *AudioPlayer) Muted() bool
- func (ap *AudioPlayer) Play(buffer *beep.Buffer)
- func (ap *AudioPlayer) PlayIndex() int
- func (ap *AudioPlayer) Playing() bool
- func (ap *AudioPlayer) Playlist() []*beep.Buffer
- func (ap *AudioPlayer) Reset()
- func (ap *AudioPlayer) ResumePlaylist()
- func (ap *AudioPlayer) SetMute(m bool)
- func (ap *AudioPlayer) SetPlayIndex(id int)
- func (ap *AudioPlayer) SetPlaylist(playlist []*beep.Buffer)
- func (ap *AudioPlayer) SetVolume(v float64)
- func (ap *AudioPlayer) Stop()
- func (ap *AudioPlayer) Volume() float64
- type Button
- func (b *Button) Active(active bool)
- func (b *Button) Disabled() bool
- func (b *Button) Draw(t pixel.Target, matrix pixel.Matrix)
- func (b *Button) DrawArea() pixel.Rect
- func (b *Button) Focus(focus bool)
- func (b *Button) Focused() bool
- func (b *Button) SetBackground(s *pixel.Sprite)
- func (b *Button) SetClickSound(s *beep.Buffer)
- func (b *Button) SetColor(c color.Color)
- func (b *Button) SetInfo(t string)
- func (b *Button) SetLabel(t string)
- func (b *Button) SetOnClickFunc(callback func(b *Button))
- func (b *Button) Size() pixel.Vec
- func (b *Button) Update(win *Window)
- type CheckSlot
- func (cs *CheckSlot) Check(check bool)
- func (cs *CheckSlot) Checked() bool
- func (cs *CheckSlot) Draw(t pixel.Target, matrix pixel.Matrix)
- func (cs *CheckSlot) DrawArea() pixel.Rect
- func (cs *CheckSlot) Label() string
- func (cs *CheckSlot) SetOnCheckFunc(f func(s *CheckSlot))
- func (cs *CheckSlot) SetSize(s pixel.Vec)
- func (cs *CheckSlot) Size() pixel.Vec
- func (cs *CheckSlot) Update(win *Window)
- func (cs *CheckSlot) Value() interface{}
- type Focus
- type Focuser
- type InfoWindow
- type List
- func (l *List) Active(active bool)
- func (l *List) AddItem(label string, value interface{})
- func (l *List) Clear()
- func (l *List) Disabled() bool
- func (l *List) Draw(t pixel.Target, matrix pixel.Matrix)
- func (l *List) DrawArea() pixel.Rect
- func (l *List) Focus(focus bool)
- func (l *List) Focused() bool
- func (l *List) InsertItems(items map[string]interface{})
- func (l *List) SelectedValue() interface{}
- func (l *List) SetDownButtonBackground(s *pixel.Sprite)
- func (l *List) SetOnItemSelectFunc(f func(i *CheckSlot))
- func (l *List) SetStartIndex(index int)
- func (l *List) SetUpButtonBackground(s *pixel.Sprite)
- func (l *List) Size() pixel.Vec
- func (l *List) Update(win *Window)
- type MessageQueue
- type MessageWindow
- func (mw *MessageWindow) Accepted() bool
- func (mw *MessageWindow) Active(active bool)
- func (mw *MessageWindow) Disabled() bool
- func (mw *MessageWindow) Dismissed() bool
- func (mw *MessageWindow) Draw(t pixel.Target, matrix pixel.Matrix)
- func (mw *MessageWindow) DrawArea() pixel.Rect
- func (mw *MessageWindow) Focus(focus bool)
- func (mw *MessageWindow) Focused() bool
- func (mw *MessageWindow) Opened() bool
- func (mw *MessageWindow) SetAcceptLabel(l string)
- func (mw *MessageWindow) SetCancelLabel(l string)
- func (mw *MessageWindow) SetOnAcceptFunc(f func(msg *MessageWindow))
- func (mw *MessageWindow) SetOnCancelFunc(f func(msg *MessageWindow))
- func (mw *MessageWindow) Show(show bool)
- func (mw *MessageWindow) Size() pixel.Vec
- func (mw *MessageWindow) Update(win *Window)
- type MultiAnimation
- func (ma *MultiAnimation) Down()
- func (ma *MultiAnimation) Draw(t pixel.Target, matrix pixel.Matrix)
- func (ma *MultiAnimation) DrawArea() pixel.Rect
- func (ma *MultiAnimation) DrawColorMask(t pixel.Target, matrix pixel.Matrix, mask color.Color)
- func (ma *MultiAnimation) Finished() bool
- func (ma *MultiAnimation) Left()
- func (ma *MultiAnimation) Loop(loop bool)
- func (ma *MultiAnimation) Restart()
- func (ma *MultiAnimation) Right()
- func (ma *MultiAnimation) Up()
- func (ma *MultiAnimation) Update(win *Window)
- type Params
- type ProgressBar
- func (pb *ProgressBar) Draw(t pixel.Target, matrix pixel.Matrix)
- func (pb *ProgressBar) DrawArea() pixel.Rect
- func (pb *ProgressBar) Max() int
- func (pb *ProgressBar) SetBackground(p pixel.Picture)
- func (pb *ProgressBar) SetColor(c color.Color)
- func (pb *ProgressBar) SetLabel(t string)
- func (pb *ProgressBar) SetMax(max int)
- func (pb *ProgressBar) SetValue(val int)
- func (pb *ProgressBar) Size() pixel.Vec
- func (pb *ProgressBar) Update(win *Window)
- func (pb *ProgressBar) Value() int
- type Shape
- type Size
- type Slot
- func (s *Slot) AddValues(vls ...interface{})
- func (s *Slot) Clear()
- func (s *Slot) Drag(drag bool)
- func (s *Slot) Dragged() bool
- func (s *Slot) Draw(t pixel.Target, matrix pixel.Matrix)
- func (s *Slot) DrawArea() pixel.Rect
- func (s *Slot) Icon() pixel.Picture
- func (s *Slot) Label() string
- func (s *Slot) Pop() interface{}
- func (s *Slot) SetColor(c color.Color)
- func (s *Slot) SetIcon(pic pixel.Picture)
- func (s *Slot) SetInfo(text string)
- func (s *Slot) SetLabel(text string)
- func (s *Slot) SetOnLeftClickFunc(f func(s *Slot))
- func (s *Slot) SetOnRightClickFunc(f func(s *Slot))
- func (s *Slot) SetOnSpecialLeftClickFunc(f func(s *Slot))
- func (s *Slot) SetOnSpecialRightClickFunc(f func(s *Slot))
- func (s *Slot) SetSpecialKey(k pixelgl.Button)
- func (s *Slot) SetValues(vls []interface{})
- func (s *Slot) Size() pixel.Vec
- func (s *Slot) Update(win *Window)
- func (s *Slot) Values() []interface{}
- type SlotList
- func (sl *SlotList) Add(s *Slot)
- func (sl *SlotList) Clear()
- func (sl *SlotList) Draw(t pixel.Target, matrix pixel.Matrix)
- func (sl *SlotList) EmptySlot() *Slot
- func (sl *SlotList) SetDownButtonBackground(s *pixel.Sprite)
- func (sl *SlotList) SetUpButtonBackground(s *pixel.Sprite)
- func (sl *SlotList) Size() pixel.Vec
- func (sl *SlotList) Slots() []*Slot
- func (sl *SlotList) Update(win *Window)
- type Switch
- func (s *Switch) Active(active bool)
- func (s *Switch) Disabled() bool
- func (s *Switch) Draw(t pixel.Target, matrix pixel.Matrix)
- func (s *Switch) DrawArea() pixel.Rect
- func (s *Switch) Find(value interface{}) int
- func (s *Switch) FindValue(index int) *SwitchValue
- func (s *Switch) Focus(focus bool)
- func (s *Switch) Focused() bool
- func (s *Switch) Reset()
- func (s *Switch) SetBackground(spr *pixel.Sprite)
- func (s *Switch) SetColor(c color.Color)
- func (s *Switch) SetIndex(index int)
- func (s *Switch) SetInfo(t string)
- func (s *Switch) SetIntValues(min, max int)
- func (s *Switch) SetLabel(t string)
- func (s *Switch) SetNextButtonBackground(spr *pixel.Sprite)
- func (s *Switch) SetOnChangeFunc(f func(s *Switch, old, new *SwitchValue))
- func (s *Switch) SetPrevButtonBackground(spr *pixel.Sprite)
- func (s *Switch) SetValues(values ...SwitchValue)
- func (s *Switch) Size() pixel.Vec
- func (s *Switch) Update(win *Window)
- func (s *Switch) Value() *SwitchValue
- type SwitchValue
- type Text
- func (t *Text) Align(a Align)
- func (t *Text) Clear()
- func (tx *Text) Draw(t pixel.Target, matrix pixel.Matrix)
- func (tx *Text) DrawArea() pixel.Rect
- func (tx *Text) SetColor(c color.Color)
- func (tx *Text) SetMaxWidth(width float64)
- func (t *Text) SetText(text string)
- func (tx *Text) Size() pixel.Vec
- func (tx *Text) String() string
- type Textbox
- func (tb *Textbox) AddText(text string)
- func (tb *Textbox) AtBottom() bool
- func (tb *Textbox) Clear()
- func (tb *Textbox) Draw(t pixel.Target, matrix pixel.Matrix)
- func (t *Textbox) DrawArea() pixel.Rect
- func (tb *Textbox) Focus(focus bool)
- func (tb *Textbox) Focused() bool
- func (tb *Textbox) ScrollBottom()
- func (tb *Textbox) SetDownButtonBackground(s *pixel.Sprite)
- func (tb *Textbox) SetMaxTextWidth(width float64)
- func (tb *Textbox) SetSize(s pixel.Vec)
- func (tb *Textbox) SetText(text ...string)
- func (tb *Textbox) SetUpButtonBackground(s *pixel.Sprite)
- func (tb *Textbox) Size() pixel.Vec
- func (tb *Textbox) String() string
- func (tb *Textbox) TextSize() pixel.Vec
- func (tb *Textbox) Update(win *Window)
- type Textedit
- func (te *Textedit) Active(active bool)
- func (te *Textedit) Clear()
- func (te *Textedit) Disabled() bool
- func (te *Textedit) Draw(t pixel.Target, matrix pixel.Matrix)
- func (te *Textedit) DrawArea() pixel.Rect
- func (te *Textedit) Focus(focus bool)
- func (te *Textedit) Focused() bool
- func (te *Textedit) SetSize(size pixel.Vec)
- func (te *Textedit) SetText(text string)
- func (te *Textedit) Size() pixel.Vec
- func (te *Textedit) Text() string
- func (te *Textedit) Update(win *Window)
- type Window
Constants ¶
Variables ¶
This section is empty.
Functions ¶
func BottomOf ¶
BottomOf returns position of rect with specified size at the bottom of speicified draw area, width specified offset value.
func ConvSize ¶
Size converts specified default size value(for 1080p) to value for current resolution.
func ConvVec ¶
ConvVec converts specified default Pixel XY vector values(for 1080p) to vector with values for current resolution.
func DisBL ¶
DisBL returns bottom left position of specified rectangle multiplied by specified value.
func DisBR ¶
DisBR returns bottom right position of specified rectangle multiplied by specified value.
func DrawPosBC ¶
DrawPosBC returns bottom center draw position(center) on specified background for object with specified size.
func DrawPosBL ¶
DrawPosBL returns bottom left draw position(center) on specified background for object with specified size.
func DrawPosBR ¶
DrawPosBR returns bottom right draw position(center) on specified background for object with specified size.
func DrawPosCL ¶
DrawPosCL returns center left draw position(center) on specified background for object with specified size.
func DrawPosCR ¶
DrawPosCR returns center right draw position(center) on specified background for object with specified size.
func DrawPosTC ¶
DrawPosTC returns top center draw position(center) on specified background for object with specified size.
func DrawPosTR ¶
DrawPosTR returns top right draw position(center) on specified background for object with specified size.
func DrawRect ¶
DrawRect draw rectangle on specified target with specified draw area(position and size) and color.
func InitAudio ¶
InitAudio initializes the system audio with specified format. It need to be called before using the audio player struct.
func LeftOf ¶
LeftOf returns position for rect with specified size at the left side of specified draw area, with specified offset value.
func MatrixToDrawArea ¶
MatrixToDrawArea calculates draw area based on specified matrix and rectangle.
func MoveBC ¶
MoveBC returns move vector from center of background with specified size to bottom center point draw position(center) for specified size.
func MoveBL ¶
MoveBL returns move vector from center of background with specified size to bottom left point draw position(center) for specified size.
func MoveBR ¶
MoveBR returns move vector from center of background with specified size to bottom right point draw position(center) for specified size.
func MoveTC ¶
MoveTC returns move vector from center of background with specified size to top center point draw position(center) for specified size.
func MoveTL ¶
MoveTL returns move vector from center of background with specified size to top left point draw position(center) for specified size.
func MoveTR ¶
MoveTR returns move vector from center of background with specified size to top right point draw position(center) for specified size.
func RightOf ¶
ReightOf returns position for rect with specified size at the right side of specified draw area, with specified offset value.
func SetButtonClickSound ¶
SetButtonClickSound sets specified audio buffer as on-click audio effect for all buttons.
func SetMainFont ¶
Sets specified truetype font as current main font of the interface.
func SlotCopy ¶
func SlotCopy(slotA, slotB *Slot)
SlotCopy copies content from slot A to slot B(overwrites current content).
func SlotSwitch ¶
func SlotSwitch(slotA, slotB *Slot)
SlotSwitch transfers all contant of slot A (value, icon, label, info) to slot B and vice versa.
Types ¶
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
Struct for animations.
func NewAnimation ¶
NewAnimation creates new animation with specified frames and FPS value. Animation is looping by default.
func (*Animation) DrawColorMask ¶
DrawColorMask draws current animation frame with specified color mask.
func (*Animation) Finished ¶
Finished checks whether animation is finished, i.e. current frame is last frame of animation.
func (*Animation) SetCurrentFrameID ¶
SetCurrentFrameID sets frame with specified ID as current draw frame of animation. If specified index is bigger than maximal frame index then first index is set, if smaller than minimal then last index is set.
type AudioPlayer ¶
type AudioPlayer struct {
// contains filtered or unexported fields
}
Struct for audio player.
func Audio ¶
func Audio() *AudioPlayer
Audio returns toolkit audio player. Returned audio player will not be operational if the audio was not initialized before with InitAudio function.
func (*AudioPlayer) AddAudio ¶
func (ap *AudioPlayer) AddAudio(ab *beep.Buffer) error
AddAudio adds specified audio stream to the current playlist.
func (*AudioPlayer) Muted ¶
func (ap *AudioPlayer) Muted() bool
Muted checks if audio player is muted.
func (*AudioPlayer) Play ¶
func (ap *AudioPlayer) Play(buffer *beep.Buffer)
Play starts playing specified audio stream.
func (*AudioPlayer) PlayIndex ¶
func (ap *AudioPlayer) PlayIndex() int
PlayIndex returns index of currently playing audio buffer from the playlist.
func (*AudioPlayer) Playing ¶
func (ap *AudioPlayer) Playing() bool
Playing checks if audio player is playing any audio buffer.
func (*AudioPlayer) Playlist ¶
func (ap *AudioPlayer) Playlist() []*beep.Buffer
Playlist returns the audio player playlist.
func (*AudioPlayer) Reset ¶
func (ap *AudioPlayer) Reset()
Reset stops player and moves play index to first music playlist index.
func (*AudioPlayer) ResumePlaylist ¶
func (ap *AudioPlayer) ResumePlaylist()
ResumePlaylist starts playing audio from the playlist for current playlist ID.
func (*AudioPlayer) SetMute ¶
func (ap *AudioPlayer) SetMute(m bool)
SetMute mutes/unmutes audio player.
func (*AudioPlayer) SetPlayIndex ¶
func (ap *AudioPlayer) SetPlayIndex(id int)
SetPlayIndex sets specified index as current index on music playlist. If specified value is bigger than playlist lenght then first index is set, if is lower than 0 then last index is set.
func (*AudioPlayer) SetPlaylist ¶
func (ap *AudioPlayer) SetPlaylist(playlist []*beep.Buffer)
SetPlaylist sets specified slice with audio streams as player playlist.
func (*AudioPlayer) SetVolume ¶
func (ap *AudioPlayer) SetVolume(v float64)
SetVolume sets specified value as current audio volume value. 0 - unmodified(system volume), > 0 - lauder, < 0 quieter.
func (*AudioPlayer) Volume ¶
func (ap *AudioPlayer) Volume() float64
Volume returns current volume value. 0 - unmodified(system volume), > 0 - lauder, < 0 quieter.
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
Button struct for UI button.
func (*Button) SetBackground ¶
SetBackground sets specified sprite as button background, also removes background color.
func (*Button) SetClickSound ¶
SetClickSound sets specified audio buffer as on-click audio effect.
func (*Button) SetOnClickFunc ¶
SetOnClickFunc sets specified function as on-click callback function.
type CheckSlot ¶
type CheckSlot struct {
// contains filtered or unexported fields
}
Struct for 'chackable' slots.
func NewCheckSlot ¶
func NewCheckSlot(label string, value interface{}, bgSize pixel.Vec, color, checkColor color.Color) *CheckSlot
NewCheckSlot creates new item for list.
func (*CheckSlot) SetOnCheckFunc ¶
SetOnCheckFunc sets specified function as function triggered after slot was selected.
type Focus ¶
type Focus struct {
// contains filtered or unexported fields
}
Focus represents user focus on UI element.
type InfoWindow ¶
type InfoWindow struct { *Text // contains filtered or unexported fields }
InfoWindow struct for small text boxes that follows mouse cursor.
func NewInfoWindow ¶
func NewInfoWindow(params Params) *InfoWindow
NewInfoWindow creates new information window.
func (*InfoWindow) DrawArea ¶
func (iw *InfoWindow) DrawArea() pixel.Rect
DrawArea returns the bounds of latest info window draw area.
type List ¶
type List struct {
// contains filtered or unexported fields
}
Struct for list with 'selectable' items.
func (*List) InsertItems ¶
InsertItems sets specified values with labels as current list content.
func (*List) SelectedValue ¶
func (l *List) SelectedValue() interface{}
SelectedValue returns value of currently selected list item.
func (*List) SetDownButtonBackground ¶
SetDownButtonBackground sets specified sprite as scroll down button background.
func (*List) SetOnItemSelectFunc ¶
SetOnItemSelectFunc sets specified function as function triggered after one of list items was selected.
func (*List) SetStartIndex ¶
SetStartIndex sets specified integer as index of first item to display. If specified value is bigger than last item index then first index(0) is set, if is smaller than 0 then last index is set.
func (*List) SetUpButtonBackground ¶
SetUpButtonBackground sets specified sprite as scroll up button background.
type MessageQueue ¶
type MessageQueue struct {
// contains filtered or unexported fields
}
MessageQueue struct for list with messages to display.
func NewMessageQueue ¶
func NewMessageQueue(focus *Focus) *MessageQueue
NewMessageQueue creates new messages queue.
func (*MessageQueue) Append ¶
func (mq *MessageQueue) Append(m *MessageWindow)
Append adds specified message to the front of queue.
func (*MessageQueue) ContainsPosition ¶
func (mq *MessageQueue) ContainsPosition(pos pixel.Vec) bool
ContainsPosition checks whether specified position is contained by any message window in the queue.
func (*MessageQueue) Draw ¶
func (mq *MessageQueue) Draw(t pixel.Target, matrix pixel.Matrix)
Draw draws all messages
func (*MessageQueue) Remove ¶
func (mq *MessageQueue) Remove(i int)
Remove removes message with specified index from queue.
func (*MessageQueue) Update ¶
func (mq *MessageQueue) Update(win *Window)
Update updates all messages in queue.
type MessageWindow ¶
type MessageWindow struct {
// contains filtered or unexported fields
}
MessageWindow struct represents UI message window.
func NewDialogWindow ¶
func NewDialogWindow(params Params) *MessageWindow
NewDialogWindow creates new dialog window with message.
func NewMessageWindow ¶
func NewMessageWindow(params Params) *MessageWindow
NewMessageWindow creates new message window instance.
func (*MessageWindow) Accepted ¶
func (mw *MessageWindow) Accepted() bool
Accepted checks whether message was accepted.
func (*MessageWindow) Active ¶
func (mw *MessageWindow) Active(active bool)
Active toggles message active state.
func (*MessageWindow) Disabled ¶
func (mw *MessageWindow) Disabled() bool
Disabled checks whether message is unactive.
func (*MessageWindow) Dismissed ¶
func (mw *MessageWindow) Dismissed() bool
Dismissed checks whether window was dismised.
func (*MessageWindow) Draw ¶
func (mw *MessageWindow) Draw(t pixel.Target, matrix pixel.Matrix)
Draw draws window.
func (*MessageWindow) DrawArea ¶
func (mw *MessageWindow) DrawArea() pixel.Rect
DrawArea returns size of current draw area.
func (*MessageWindow) Focus ¶
func (mw *MessageWindow) Focus(focus bool)
Focus sets or removes focus from window.
func (*MessageWindow) Focused ¶
func (mw *MessageWindow) Focused() bool
Focused checks whether window is focused.
func (*MessageWindow) Opened ¶
func (mw *MessageWindow) Opened() bool
Opened checks whether window should be open.
func (*MessageWindow) SetAcceptLabel ¶
func (mw *MessageWindow) SetAcceptLabel(l string)
SetAcceptLabel sets label for accept button.
func (*MessageWindow) SetCancelLabel ¶
func (mw *MessageWindow) SetCancelLabel(l string)
SetCancelLabel sets label for cancel button.
func (*MessageWindow) SetOnAcceptFunc ¶
func (mw *MessageWindow) SetOnAcceptFunc(f func(msg *MessageWindow))
SetOnAcceptFunc sets specified function as function triggered after message was accepted.
func (*MessageWindow) SetOnCancelFunc ¶
func (mw *MessageWindow) SetOnCancelFunc(f func(msg *MessageWindow))
SetOnCancelFunc sets specified function as function triggered after message was canceled.
func (*MessageWindow) Show ¶
func (mw *MessageWindow) Show(show bool)
Show toggles window visibility.
func (*MessageWindow) Size ¶
func (mw *MessageWindow) Size() pixel.Vec
Size resturns message window size.
func (*MessageWindow) Update ¶
func (mw *MessageWindow) Update(win *Window)
Update handles key press events.
type MultiAnimation ¶
type MultiAnimation struct {
// contains filtered or unexported fields
}
Struct with sparate animation for each direction(up, right, down and left).
func NewMultiAnimation ¶
func NewMultiAnimation(up, right, down, left *Animation) *MultiAnimation
NewMultiAnimation creates new multi direction animation from specified animations(up, right, down, left).
func (*MultiAnimation) Down ¶
func (ma *MultiAnimation) Down()
Down sets animation direction to down.
func (*MultiAnimation) Draw ¶
func (ma *MultiAnimation) Draw(t pixel.Target, matrix pixel.Matrix)
Draw draws animation for current dirtection.
func (*MultiAnimation) DrawArea ¶
func (ma *MultiAnimation) DrawArea() pixel.Rect
DrawArea returns current draw area.
func (*MultiAnimation) DrawColorMask ¶
Draw draws animation for current dirtection with color mask.
func (*MultiAnimation) Finished ¶
func (ma *MultiAnimation) Finished() bool
Finished checks whether current animation is finished.
func (*MultiAnimation) Left ¶
func (ma *MultiAnimation) Left()
Left sets animation direction to left.
func (*MultiAnimation) Loop ¶
func (ma *MultiAnimation) Loop(loop bool)
Loop toggles animation looping for each direction.
func (*MultiAnimation) Restart ¶
func (ma *MultiAnimation) Restart()
Restart restarts all animations.
func (*MultiAnimation) Right ¶
func (ma *MultiAnimation) Right()
Right sets animation direction to right.
func (*MultiAnimation) Update ¶
func (ma *MultiAnimation) Update(win *Window)
Update updates animation for current direction.
type Params ¶
type Params struct { MainColor color.Color SecColor color.Color AccentColor color.Color Size Size SizeRaw pixel.Vec FontSize Size Shape Shape Background *pixel.Sprite Label string Info string }
Struct for MTK graphical widget parameters.
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
Struct for progress bars.
func NewProgressBar ¶
func NewProgressBar(size Size, color color.Color) *ProgressBar
NewProgressBar creates new progress bar with IMDraw background bar with specified size, color and label text.
func (*ProgressBar) Draw ¶
func (pb *ProgressBar) Draw(t pixel.Target, matrix pixel.Matrix)
Draw draws progress bar.
func (*ProgressBar) DrawArea ¶
func (pb *ProgressBar) DrawArea() pixel.Rect
DrawArea returns current last draw area of this element.
func (*ProgressBar) SetBackground ¶
func (pb *ProgressBar) SetBackground(p pixel.Picture)
SetBackground sets specified sprite as bar background, also removes current background color.
func (*ProgressBar) SetColor ¶
func (pb *ProgressBar) SetColor(c color.Color)
SetColor sets specified color as background color.
func (*ProgressBar) SetLabel ¶
func (pb *ProgressBar) SetLabel(t string)
SetLabel sets specified text as progress label.
func (*ProgressBar) SetMax ¶
func (pb *ProgressBar) SetMax(max int)
SetMax sets specified value as progress maximal value.
func (*ProgressBar) SetValue ¶
func (pb *ProgressBar) SetValue(val int)
SetValue sets specified value as current progress value.
func (*ProgressBar) Update ¶
func (pb *ProgressBar) Update(win *Window)
Update updates progress bar.
func (*ProgressBar) Value ¶
func (pb *ProgressBar) Value() int
Value retruns current progress value.
type Size ¶
type Size int
Type for sizes of UI elements, like buttons, switches, etc. Sizes: mini(0), small(1), medium(2), big(3), huge(4).
func (Size) ButtonSize ¶
ButtonSize returns szie parameters for button with this size and with specifed shape.
func (Size) MessageWindowSize ¶
MessageWindowSize returns size parameters for message window.
func (Size) SwitchSize ¶
SwitchSize return rectangele parameters for switch with this size.
type Slot ¶
type Slot struct {
// contains filtered or unexported fields
}
Struct for slot.
func (*Slot) AddValues ¶
func (s *Slot) AddValues(vls ...interface{})
AddValue adds specified interface to slot values list.
func (*Slot) Pop ¶
func (s *Slot) Pop() interface{}
Pop removes and returns first value from slot. Clears slot if removed value was last value in slot.
func (*Slot) SetOnLeftClickFunc ¶
SetOnLeftClickFunc set speicfied function as function triggered after left mouse click event.
func (*Slot) SetOnRightClickFunc ¶
SetOnClickFunc set speicfied function as function triggered after right mouse click event.
func (*Slot) SetOnSpecialLeftClickFunc ¶
SetOnSpecialLeftClickFunc set speicfied function as function triggered after special key pressed + left mouse click event.
func (*Slot) SetOnSpecialRightClickFunc ¶
SetOnSpecialRightClickFunc set speicfied function as function triggered after special key pressed + right mouse click event.
func (*Slot) SetSpecialKey ¶
SetSpecialKey sets special key for slot click events.
type SlotList ¶
type SlotList struct {
// contains filtered or unexported fields
}
Struct for list with slots.
func NewSlotList ¶
NewSlotList creates new list with slots.
func (*SlotList) SetDownButtonBackground ¶
SetDownButtonBackground sets specified sprite as scroll down button background.
func (*SlotList) SetUpButtonBackground ¶
SetUpButtonBackground sets specified sprite as scroll up button background.
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
Switch struct represents graphical switch for values.
func (*Switch) Find ¶
Find checks if switch constains specified value and returns index of this value or -1 if switch does not contains such value.
func (*Switch) FindValue ¶
func (s *Switch) FindValue(index int) *SwitchValue
Find searches switch values for value with specified index and returns this value or nil if switch does not contains value with such index.
func (*Switch) SetBackground ¶
SetBackground sets specified sprite as switch background, also removes background color.
func (*Switch) SetIndex ¶
SetIndex sets value with specified index as current value of this switch. If specified value is bigger than maximal possible index, then index of first value is set, if specified index is smaller than minimal, then index of last value is set.
func (*Switch) SetIntValues ¶
SwtIntValues adds to witch all integers from specified min/max range.
func (*Switch) SetNextButtonBackground ¶
SetNextButtonBackground sets specified sprite as next button background.
func (*Switch) SetOnChangeFunc ¶
func (s *Switch) SetOnChangeFunc(f func(s *Switch, old, new *SwitchValue))
Sets specified function as function triggered on on switch value change.
func (*Switch) SetPrevButtonBackground ¶
SetPrevButtonBackground sets specified sprite as previous button background.
func (*Switch) SetValues ¶
func (s *Switch) SetValues(values ...SwitchValue)
SetValues sets specified list with values as switch values.
type SwitchValue ¶
type SwitchValue struct { View interface{} Value interface{} }
Tuple for switch values, contains value to display(view) and real value.
type Text ¶
Text struct for short text like labels, names, etc.
func (*Text) SetMaxWidth ¶
SetMaxWidth sets maximal width of single text line.
type Textbox ¶
type Textbox struct {
// contains filtered or unexported fields
}
Struct for textboxes.
func NewTextbox ¶
NewTextbox creates new textbox with specified parameters.
func (*Textbox) ScrollBottom ¶
func (tb *Textbox) ScrollBottom()
ScrollBottom scrolls textbox to last lines of text content.
func (*Textbox) SetDownButtonBackground ¶
SetDownButtonBackground sets specified sprite as scroll down button background.
func (*Textbox) SetMaxTextWidth ¶
SetMaxTextWidth sets maximal width of single line in text area.
func (*Textbox) SetUpButtonBackground ¶
SetUpButtonBackground sets specified sprite as scroll up button background.
type Textedit ¶
type Textedit struct {
// contains filtered or unexported fields
}
Struct for text edit fields.
func NewTextedit ¶
NewTextedit creates new textedit based on specified parameters.
type Window ¶
Wrapper struct for pixel window, to provide scalability.
func NewWindow ¶
func NewWindow(conf pixelgl.WindowConfig) (*Window, error)
NewWindow creates new MTK window.
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
example
|
|
animation
Example for creating simple MTK animation.
|
Example for creating simple MTK animation. |
audioplayer/control
Example of controlling audio player.
|
Example of controlling audio player. |
audioplayer/play
Example of using audio player.
|
Example of using audio player. |
button
Example for creating simple MTK button with draw background, custom on-click function, and click sound effect.
|
Example for creating simple MTK button with draw background, custom on-click function, and click sound effect. |
infowindow
Example for the MTK info window.
|
Example for the MTK info window. |
list
Example of creating and using list.
|
Example of creating and using list. |
messagequeue
Example for the MTK Message Queue.
|
Example for the MTK Message Queue. |
messagewindow
Example for creating MTK message window.
|
Example for creating MTK message window. |
slot
Example of creating and using slot.
|
Example of creating and using slot. |
slotlist
Example of creating and using slot list.
|
Example of creating and using slot list. |
switch/number
Example for creating MTK switch with number values.
|
Example for creating MTK switch with number values. |
switch/toggle
Example for creating MTK switch.
|
Example for creating MTK switch. |
text
Example of creating text to draw.
|
Example of creating text to draw. |
textbox
Example of creating and using MTK textbox.
|
Example of creating and using MTK textbox. |
textedit
Example of creating and using MTK textedit.
|
Example of creating and using MTK textedit. |
window
Example of creating MTK window.
|
Example of creating MTK window. |