Documentation ¶
Index ¶
- Constants
- func CreateTexture(glctx gl.Context, c image_color.RGBA) (tex gl.Texture, err error)
- func LoadAsset(name string) ([]byte, error)
- func LoadProgram(glctx gl.Context, vertexAsset, fragmentAsset string) (p gl.Program, err error)
- func LoadTexture(glctx gl.Context, name string) (tex gl.Texture, err error)
- type BaseWidget
- type Button
- func (b *Button) Build(ui *UiEngine)
- func (b *Button) CallHandler() interface{}
- func (b *Button) CreateTextTexture(ui *UiEngine)
- func (b *Button) Draw(ui *UiEngine)
- func (b *Button) Pressed(ui *UiEngine, touchx, touchy float32) bool
- func (b *Button) RegisterHandler(handler interface{}, handlerData interface{})
- func (b *Button) SetText(ui *UiEngine, text string)
- func (b *Button) UpdateTexture(ui *UiEngine, force bool)
- type ButtonOld
- type DeviceSpecs
- type DisplayGeom
- type FPS
- type FontEngine
- func (fe *FontEngine) CenterText(text string, xmax, ymax int) fixed.Point26_6
- func (fe *FontEngine) PtToPx(p int) int
- func (fe *FontEngine) RenderText(text string, xmax, ymax int) *image.RGBA
- func (fe *FontEngine) RenderTextCustom(text string, xmax, ymax int, col image_color.RGBA) *image.RGBA
- func (fe *FontEngine) SetFontSize(size int)
- func (fe *FontEngine) SetHinting(hinting string)
- type Label
- type Layout
- func (l *Layout) AddButton(text string) *Button
- func (l *Layout) AddLabel(text string) *Label
- func (l *Layout) AddSlider(label string, initialValue interface{}) *Slider
- func (l *Layout) Build(ui *UiEngine)
- func (l *Layout) BuildElement(ui *UiEngine, index int, min, max Point)
- func (l *Layout) Draw(ui *UiEngine)
- func (l *Layout) Init(ui *UiEngine, min, max Point, zLevel float32, layoutType int)
- func (l *Layout) Pressed(ui *UiEngine, touchx, touchy float32)
- func (l *Layout) UpdateTexture(ui *UiEngine, force bool)
- type Point
- type ShaderVariables
- type Slider
- func (s *Slider) Build(ui *UiEngine)
- func (s *Slider) Draw(ui *UiEngine)
- func (s *Slider) Pressed(ui *UiEngine, touchx, touchy float32) bool
- func (s *Slider) RegisterHandlerLeft(handler interface{}, handlerData interface{})
- func (s *Slider) RegisterHandlerRight(handler interface{}, handlerData interface{})
- func (s *Slider) SetValueText(ui *UiEngine, text string)
- func (s *Slider) UpdateTexture(ui *UiEngine, force bool)
- type UiEngine
- func (ui *UiEngine) AddHorizontalWindow(min, max Point, c image_color.RGBA) *Window
- func (ui *UiEngine) AddWindow(min, max Point, c image_color.RGBA) *Window
- func (ui *UiEngine) AspectRatio() float32
- func (ui *UiEngine) Build()
- func (ui *UiEngine) ButtonPressed(button *ButtonOld, touchx, touchy float32) bool
- func (ui *UiEngine) CheckButtonPresses(touchx, touchy float32) int
- func (ui *UiEngine) CleanUp()
- func (ui *UiEngine) ConvertToPx(delta float32, dim int) int
- func (ui *UiEngine) CreateButtonOld(text string, min, max Point) *ButtonOld
- func (ui *UiEngine) CreateWindow(min, max Point, c image_color.RGBA)
- func (ui *UiEngine) DeleteBaseGeom(geom *DisplayGeom)
- func (ui *UiEngine) DrawAllButtons()
- func (ui *UiEngine) DrawAllWindows()
- func (ui *UiEngine) DrawBaseGeom(geom *DisplayGeom)
- func (ui *UiEngine) DrawButton(id int)
- func (ui *UiEngine) InitAllButtons()
- func (ui *UiEngine) InitAllWindows()
- func (ui *UiEngine) InitBaseGeom(geom *DisplayGeom)
- func (ui *UiEngine) InitButton(id int)
- func (ui *UiEngine) SetDevice(dev *DeviceSpecs)
- func (ui *UiEngine) SetFontSize(size int)
- func (ui *UiEngine) String() string
- func (ui *UiEngine) UpdateButtonText(button *ButtonOld, newText string)
- type UiGesture
- type Window
- func (win *Window) AddButton(text string) *Button
- func (win *Window) AddLabel(text string) *Label
- func (win *Window) AddLayout(layoutType int)
- func (win *Window) AddSlider(label string, value interface{}) *Slider
- func (win *Window) Build(ui *UiEngine)
- func (win *Window) Draw(ui *UiEngine)
- func (win *Window) HandleTouch(ui *UiEngine, touchx, touchy float32)
- func (win *Window) SetPadding(padding float32)
- func (win *Window) UpdateTexture(ui *UiEngine, force bool)
Constants ¶
const ( VERTICAL = 0x1 HORIZONTAL = 0x2 )
const ( X = 0 Y = 1 Z = 2 )
const ( FIT = 0x0001 FULL = 0x2 )
Simple layout engine for Window
Variables ¶
This section is empty.
Functions ¶
func CreateTexture ¶
CreateTexture reads and decodes an image from the asset repository and creates a texture object based on the full dimensions of the image.
func LoadProgram ¶
LoadProgram reads shader sources from the asset repository, compiles, and links them into a program.
Types ¶
type BaseWidget ¶
type BaseWidget struct {
// contains filtered or unexported fields
}
func CreateBaseWidget ¶
func CreateBaseWidget(ui *UiEngine, min, max Point, zLevel float32) *BaseWidget
func (*BaseWidget) Build ¶
func (base *BaseWidget) Build(ui *UiEngine)
func (*BaseWidget) CreateDisplayGeom ¶
func (base *BaseWidget) CreateDisplayGeom(ui *UiEngine)
CreateDisplayGeom - Creates the geometry that is used for rendering the widget to screen
func (*BaseWidget) Draw ¶
func (base *BaseWidget) Draw(ui *UiEngine, hint bool)
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
func CreateButton ¶
func (*Button) CallHandler ¶
func (b *Button) CallHandler() interface{}
func (*Button) CreateTextTexture ¶
func (*Button) RegisterHandler ¶
func (b *Button) RegisterHandler(handler interface{}, handlerData interface{})
func (*Button) UpdateTexture ¶
type ButtonOld ¶
type ButtonOld struct {
// contains filtered or unexported fields
}
FIXME Remove after refactoring UI Code
type DeviceSpecs ¶
type DisplayGeom ¶
type DisplayGeom struct {
// contains filtered or unexported fields
}
DisplayGeom - Object containing all the information required to draw
a rectangle to the screen
func CreateDisplayGeom ¶
func CreateDisplayGeom(glctx gl.Context, xmin, ymin, xmax, ymax, zlevel, ar float32) *DisplayGeom
ar = Aspect Ratio
type FPS ¶
type FPS struct {
// contains filtered or unexported fields
}
FPS draws a count of the frames rendered per second.
type FontEngine ¶
type FontEngine struct {
// contains filtered or unexported fields
}
func CreateFontEngine ¶
func CreateFontEngine(device *DeviceSpecs) *FontEngine
func (*FontEngine) CenterText ¶
func (fe *FontEngine) CenterText(text string, xmax, ymax int) fixed.Point26_6
func (*FontEngine) PtToPx ¶
func (fe *FontEngine) PtToPx(p int) int
func (*FontEngine) RenderText ¶
func (fe *FontEngine) RenderText(text string, xmax, ymax int) *image.RGBA
func (*FontEngine) RenderTextCustom ¶
func (fe *FontEngine) RenderTextCustom(text string, xmax, ymax int, col image_color.RGBA) *image.RGBA
RenderText - Renders text using the freetype font
func (*FontEngine) SetFontSize ¶
func (fe *FontEngine) SetFontSize(size int)
Sets the font size to be used for rendering text using the FontEngine
func (*FontEngine) SetHinting ¶
func (fe *FontEngine) SetHinting(hinting string)
Sets the options of if font hinting (none|full) is to be used
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
func CreateLabel ¶
func (*Label) CreateTextTexture ¶
CreateTextTexture creares a text texture based on label text This method shares a decent bit of code with Button::CreateTextTexture, refactor as utility
func (*Label) UpdateTexture ¶
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func (*Layout) Build ¶
Build - This method sizes all the widgets in the layout accorting to the layoutType
func (*Layout) BuildElement ¶
func (*Layout) UpdateTexture ¶
type ShaderVariables ¶
type ShaderVariables struct {
// contains filtered or unexported fields
}
type Slider ¶
type Slider struct {
// contains filtered or unexported fields
}
func CreateSlider ¶
func (*Slider) RegisterHandlerLeft ¶
func (s *Slider) RegisterHandlerLeft(handler interface{}, handlerData interface{})
func (*Slider) RegisterHandlerRight ¶
func (s *Slider) RegisterHandlerRight(handler interface{}, handlerData interface{})
func (*Slider) SetValueText ¶
func (*Slider) UpdateTexture ¶
type UiEngine ¶
type UiEngine struct {
// contains filtered or unexported fields
}
UiEngine - Struct reponsible for creating and managing all UI Assets on screen
func CreateUiEngine ¶
func CreateUiEngine(glctx gl.Context, device *DeviceSpecs) *UiEngine
func (*UiEngine) AddHorizontalWindow ¶
func (ui *UiEngine) AddHorizontalWindow(min, max Point, c image_color.RGBA) *Window
func (*UiEngine) AddWindow ¶
func (ui *UiEngine) AddWindow(min, max Point, c image_color.RGBA) *Window
func (*UiEngine) AspectRatio ¶
func (*UiEngine) ButtonPressed ¶
func (*UiEngine) CheckButtonPresses ¶
func (*UiEngine) CreateButtonOld ¶
func (*UiEngine) CreateWindow ¶
func (ui *UiEngine) CreateWindow(min, max Point, c image_color.RGBA)
func (*UiEngine) DeleteBaseGeom ¶
func (ui *UiEngine) DeleteBaseGeom(geom *DisplayGeom)
func (*UiEngine) DrawAllButtons ¶
func (ui *UiEngine) DrawAllButtons()
func (*UiEngine) DrawAllWindows ¶
func (ui *UiEngine) DrawAllWindows()
func (*UiEngine) DrawBaseGeom ¶
func (ui *UiEngine) DrawBaseGeom(geom *DisplayGeom)
func (*UiEngine) DrawButton ¶
func (*UiEngine) InitAllButtons ¶
func (ui *UiEngine) InitAllButtons()
func (*UiEngine) InitAllWindows ¶
func (ui *UiEngine) InitAllWindows()
func (*UiEngine) InitBaseGeom ¶
func (ui *UiEngine) InitBaseGeom(geom *DisplayGeom)
func (*UiEngine) InitButton ¶
func (*UiEngine) SetDevice ¶
func (ui *UiEngine) SetDevice(dev *DeviceSpecs)
func (*UiEngine) SetFontSize ¶
func (*UiEngine) UpdateButtonText ¶
type UiGesture ¶
type UiGesture struct { LongTouchPrevTime time.Time DoubleTouchPrevTime time.Time LongTouchMeasure bool LongTouch bool DoubleTouch bool TouchDrag bool ProcessingClickBottom bool ProcessingClick bool TouchX float32 TouchY float32 PrevTouchX float32 PrevTouchY float32 }
func CreateUiGesture ¶
func CreateUiGesture() *UiGesture
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func CreateWindow ¶
func (*Window) HandleTouch ¶
func (*Window) SetPadding ¶
Padding for the default window layout