Documentation ¶
Index ¶
- type BaseButton
- type BaseWidget
- func (b *BaseWidget) AddParentPanel(parentPanel IPanel) error
- func (b *BaseWidget) CheckMouseEventCoords(event events.IEvent) (bool, error)
- func (b *BaseWidget) ContainsCoords(x float64, y float64) bool
- func (b *BaseWidget) Draw(screen *ebiten.Image) error
- func (b *BaseWidget) GenerateLocalCoordMouseEvent(incomingEvent events.MouseEvent) events.MouseEvent
- func (b *BaseWidget) GetData() (interface{}, error)
- func (b *BaseWidget) GetID() string
- func (b *BaseWidget) GetSize() (float64, float64)
- func (b *BaseWidget) GetXY() (float64, float64)
- func (b *BaseWidget) GlobalToLocalCoords(x float64, y float64) (float64, float64)
- func (b *BaseWidget) SetXY(x float64, y float64) error
- type Canvas
- type CheckBox
- type EmptySpace
- type HPanel
- type IButton
- type IPanel
- type IWidget
- type ImageButton
- type Label
- type Panel
- func (p *Panel) AddWidget(w IWidget) error
- func (p *Panel) ClearWidgets() error
- func (p *Panel) Draw(screen *ebiten.Image) error
- func (p *Panel) GetCoords() (float64, float64)
- func (p *Panel) GetDeltaOffset() (bool, float64, float64)
- func (p *Panel) HandleEvent(event events.IEvent) error
- func (p *Panel) HandleKeyboardEvent(event events.IEvent) (bool, error)
- func (p *Panel) HandleMouseEvent(event events.IEvent) (bool, error)
- func (p *Panel) ListPanels() []Panel
- func (p *Panel) ListWidgets() []IWidget
- func (p *Panel) SetSize(width int, height int) error
- func (p *Panel) SetTopLevel(topLevel bool)
- type RadioButtonGroup
- type TextButton
- type TextInput
- type Toolbar
- type ToolbarItem
- type VPanel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseButton ¶
type BaseButton struct { BaseWidget // contains filtered or unexported fields }
func NewBaseButton ¶
func (*BaseButton) HandleEvent ¶
func (b *BaseButton) HandleEvent(event events.IEvent) error
type BaseWidget ¶
type BaseWidget struct { ID string // Location of top left of widget. // This is always relative to the parent widget. X float64 Y float64 Width int Height int // widget disabled (and shouldn't be rendered.... OR.... greyed out? Disabled bool // direct parent of window.... hack to sort out mouse positioning... TopLevel bool // contains filtered or unexported fields }
BaseWidget is the common element of ALL disable items. Widgets, buttons, panels etc. Should only handle some basic items like location, width, height and possibly events.
func NewBaseWidget ¶
func (*BaseWidget) AddParentPanel ¶
func (b *BaseWidget) AddParentPanel(parentPanel IPanel) error
func (*BaseWidget) CheckMouseEventCoords ¶
func (b *BaseWidget) CheckMouseEventCoords(event events.IEvent) (bool, error)
func (*BaseWidget) ContainsCoords ¶
func (b *BaseWidget) ContainsCoords(x float64, y float64) bool
ContainsCoords determines if co-ordinates... co-ords passed are GLOBAL and need to be converted.
func (*BaseWidget) GenerateLocalCoordMouseEvent ¶
func (b *BaseWidget) GenerateLocalCoordMouseEvent(incomingEvent events.MouseEvent) events.MouseEvent
GenerateLocalCoordMouseEvent takes an incoming MouseEvent and converts the X,Y co-ordinates to something relative to the current widget. The incoming MouseEvent co-ords are relative to the parent.
func (*BaseWidget) GetData ¶
func (b *BaseWidget) GetData() (interface{}, error)
func (*BaseWidget) GetID ¶
func (b *BaseWidget) GetID() string
func (*BaseWidget) GetSize ¶
func (b *BaseWidget) GetSize() (float64, float64)
func (*BaseWidget) GetXY ¶
func (b *BaseWidget) GetXY() (float64, float64)
func (*BaseWidget) GlobalToLocalCoords ¶
func (b *BaseWidget) GlobalToLocalCoords(x float64, y float64) (float64, float64)
GlobalToLocalCoords takes global co-ords and modifies it to local co-ords. It figures this out by keeping a global offset to base off. It gets the global offset by asking its parents for offset. The parent asks its parent and so on. THINK this should work. Remember LOCAL co-ords are really based off the parents co-ords... as in a widgets x,y is based off the parents 0,0.... man I need to explain that more clearly.
type Canvas ¶
type Canvas struct {
BaseWidget
}
Canvas is just an image that will be updated outside of the UI framework. eg client could play a video to it (frame by frame)... etc. Just to testing out/playing
func (*Canvas) GetUnderlyingImage ¶
type CheckBox ¶
type CheckBox struct { BaseWidget // contains filtered or unexported fields }
func NewCheckBox ¶
type EmptySpace ¶
type EmptySpace struct {
BaseWidget
}
EmptySpace lame way to put spaces in panels..
func NewEmptySpace ¶
func NewEmptySpace(ID string, width int, height int) *EmptySpace
func (*EmptySpace) Draw ¶
func (b *EmptySpace) Draw(screen *ebiten.Image) error
do we event need this?
func (*EmptySpace) HandleEvent ¶
func (b *EmptySpace) HandleEvent(event events.IEvent) error
type HPanel ¶
HPanel stacks internal objects horizonally... left to right.
func NewHPanelWithSize ¶
func (*HPanel) AddWidget ¶
AddWidget adds a widget to the panel, but each widget is to the right of the previous one.
func (*HPanel) ClearWidgets ¶
type IPanel ¶
type IPanel interface { AddWidget(w IWidget) error Draw(screen *ebiten.Image) error HandleEvent(event events.IEvent) error SetTopLevel(bool) SetSize(width int, height int) error GetSize() (float64, float64) ContainsCoords(x float64, y float64) bool // contains co-ords... co-ords are based on immediate parents location/size. ListWidgets() []IWidget ListPanels() []Panel GetCoords() (float64, float64) GetDeltaOffset() (bool, float64, float64) GlobalToLocalCoords(x float64, y float64) (float64, float64) AddParentPanel(parentPanel IPanel) error ClearWidgets() error }
type IWidget ¶
type IWidget interface { Draw(screen *ebiten.Image) error HandleEvent(event events.IEvent) error GetData() (interface{}, error) // absolutely HATE the empty interface, but this will need to be extremely generic I suppose? ContainsCoords(x float64, y float64) bool // contains co-ords... co-ords are based on immediate parents location/size. GlobalToLocalCoords(x float64, y float64) (float64, float64) AddParentPanel(parentPanel IPanel) error SetXY(x float64, y float64) error GetXY() (float64, float64) GetSize() (float64, float64) GetID() string }
IWidget defines what actions can be performed on a widget. Hate using the I* notation... but will do for now.
type ImageButton ¶
type ImageButton struct { BaseButton // contains filtered or unexported fields }
func NewImageButton ¶
type Label ¶
type Label struct { BaseWidget // contains filtered or unexported fields }
type Panel ¶
type Panel struct { BaseWidget // DynamicSize is for when we based sizes off window/panels etc. ie everything is // proportional as opposed to absolute. DynamicSize bool // contains filtered or unexported fields }
Panel has a position, width and height. Panels contain other widgets (and also other panels).
func (*Panel) AddWidget ¶
AddWidget adds a widget to a panel and subscribes the widget to a number of events (generated from the panel)
func (*Panel) ClearWidgets ¶
func (*Panel) Draw ¶
Draw renders all the widgets inside the panel (and the panel itself.. .if there is anything to it?)
func (*Panel) HandleEvent ¶
HandlEvent returns true if related to this panel. eg, mouse was in its borders etc. Keyboard... well, will accept anyway (need to figure out focusing for that).
func (*Panel) HandleKeyboardEvent ¶
func (*Panel) HandleMouseEvent ¶
func (*Panel) ListPanels ¶
func (*Panel) ListWidgets ¶
func (*Panel) SetTopLevel ¶
type RadioButtonGroup ¶
type RadioButtonGroup struct { Panel // contains filtered or unexported fields }
func NewRadioButtonGroup ¶
func (*RadioButtonGroup) AddRadioButton ¶
func (rb *RadioButtonGroup) AddRadioButton(buttonText string) error
AddRadioButton adds a new radio button to the radio button group. temporarily just trying the checkbox here.
func (*RadioButtonGroup) HandleEvent ¶
func (rb *RadioButtonGroup) HandleEvent(event events.IEvent) error
type TextButton ¶
type TextButton struct { BaseButton Rect image.Rectangle // contains filtered or unexported fields }
TextButton is a button that just has a background colour, text and text colour.
func NewTextButton ¶
func NewTextButton(ID string, text string, useImageforSize bool, width int, height int, nonPressedBackgroundColour *color.RGBA, pressedBackgroundColour *color.RGBA, fontInfo *common.Font, handler func(event events.IEvent) error) *TextButton
NewTextButton. Button will have specified dimensions of width and height, useImageForSize is true. Then take the size from the contained text
type TextInput ¶
type TextInput struct { BaseWidget // contains filtered or unexported fields }
func NewTextInput ¶
type Toolbar ¶
Toolbar stacks internal objects horizonally... left to right.
func (*Toolbar) AddToolBarItem ¶
AddToolBarItem add toolbaritem. Basically just an alias to HPanel.AddWidget for now... but that could change.
type ToolbarItem ¶
type ToolbarItem struct {
ImageButton
}
Toolbar stacks internal objects horizonally... left to right.
func NewToolbarItem ¶
func NewToolbarItem(ID string, handler func(event events.IEvent) error) *ToolbarItem
type VPanel ¶
type VPanel struct { Panel // Y offset for next widget to be added. YLoc float64 // contains filtered or unexported fields }
VPanel stacks internal objects vertically.... starting at top and going down... so umm reverse panel :)
func NewVPanelWithSize ¶
func (*VPanel) AddWidget ¶
AddWidget adds a widget to the panel, but each widget is below the next one.