builtin

package
v0.2.0-preview.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 18, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

builtin package provides a set of basic components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BezierView

type BezierView struct {
	engine.ViewImpl
	rendering.Appearance
	ControlPoint1, ControlPoint2 a.Vector3
}

func NewBezierView

func NewBezierView(cp1, cp2 a.Vector3) *BezierView

func (*BezierView) GetName

func (b *BezierView) GetName() string

func (*BezierView) OnDraw

func (b *BezierView) OnDraw(ctx engine.DrawingContext)

type BoundaryView

type BoundaryView struct {
	engine.ViewImpl
}

func NewBoundaryView

func NewBoundaryView() *BoundaryView

func (*BoundaryView) GetName

func (r *BoundaryView) GetName() string

func (*BoundaryView) OnDraw

func (r *BoundaryView) OnDraw(ctx engine.DrawingContext)

type BuilderComponent

type BuilderComponent struct {
	// contains filtered or unexported fields
}

func (*BuilderComponent) GetName

func (c *BuilderComponent) GetName() string

func (*BuilderComponent) OnInit

func (c *BuilderComponent) OnInit(ctx engine.InitContext)

func (*BuilderComponent) OnStart

func (c *BuilderComponent) OnStart()

func (*BuilderComponent) OnStop

func (c *BuilderComponent) OnStop()

func (*BuilderComponent) OnUpdate

func (c *BuilderComponent) OnUpdate(ctx engine.UpdateContext)

type CircleBoundary

type CircleBoundary struct {
	// contains filtered or unexported fields
}

func NewCircleBoundary

func NewCircleBoundary() *CircleBoundary

func (*CircleBoundary) GetName

func (r *CircleBoundary) GetName() string

func (*CircleBoundary) IsPointInside

func (r *CircleBoundary) IsPointInside(_ a.Vector3) bool

func (*CircleBoundary) IsPointInside2D

func (r *CircleBoundary) IsPointInside2D(point a.Vector3) bool

func (*CircleBoundary) OnInit

func (r *CircleBoundary) OnInit(ctx engine.InitContext)

func (*CircleBoundary) OnStart

func (r *CircleBoundary) OnStart()

func (*CircleBoundary) OnStop

func (r *CircleBoundary) OnStop()

type ComponentBuilder

type ComponentBuilder struct {
	// contains filtered or unexported fields
}

func NewComponentBuilder

func NewComponentBuilder(name string) *ComponentBuilder

func (*ComponentBuilder) Build

func (b *ComponentBuilder) Build() *BuilderComponent

func (*ComponentBuilder) OnStart

func (b *ComponentBuilder) OnStart(onStart func()) *ComponentBuilder

func (*ComponentBuilder) OnStop

func (b *ComponentBuilder) OnStop(onStop func()) *ComponentBuilder

func (*ComponentBuilder) OnUpdate

func (b *ComponentBuilder) OnUpdate(onUpdate func(ctx engine.UpdateContext)) *ComponentBuilder
type DropdownView struct {
	engine.ViewImpl

	OnSelect OnSelectHandler
	// contains filtered or unexported fields
}

func NewDropdownView

func NewDropdownView(options []string) *DropdownView
func (d *DropdownView) GetName() string
func (d *DropdownView) GetSelectedItem() string
func (d *DropdownView) HandleClick()
func (d *DropdownView) OnDraw(ctx engine.DrawingContext)
func (d *DropdownView) OnStart()
func (d *DropdownView) OnStop()
func (d *DropdownView) SetItems(items []string)
func (d *DropdownView) SetSelectedItem(item string)

type EventListener added in v0.1.2

type EventListener struct {
	engine.ComponentImpl
	EventCode int                 `state:"eventCode"`
	Handler   engine.EventHandler `state:"handler"`
}

EventListener is used to detect and handle scene object events. It react to the events with the specified code and invokes the specified event handler.

func NewEventListener added in v0.1.2

func NewEventListener(eventCode int, handler engine.EventHandler) *EventListener

Creates a new EventListener, that reacts to the events with the specified code and invokes the specified handler.

func (*EventListener) GetName added in v0.1.2

func (l *EventListener) GetName() string

func (*EventListener) OnMessage added in v0.1.2

func (l *EventListener) OnMessage(msg engine.Message) bool

type GridLayout

type GridLayout struct {
	engine.ComponentImpl
	Rows       int `state:"rows"`
	Cols       int `state:"cols"`
	RowPadding int `state:"rowPadding"`
	ColPadding int `state:"colPadding"`
}

func NewGridLayout

func NewGridLayout() *GridLayout

func (*GridLayout) GetName

func (l *GridLayout) GetName() string

func (*GridLayout) LayoutChildren

func (l *GridLayout) LayoutChildren()

type ImageView

type ImageView struct {
	engine.ViewImpl
	ResId    a.ResId `state:"resId"`
	ImageUrl string  `state:"imageUrl"`
}

Displays an image given it's resource index

func NewImageView

func NewImageView(index a.ResId) *ImageView

func NewImageViewWithUrl added in v0.1.1

func NewImageViewWithUrl(url string) *ImageView

func (*ImageView) GetName

func (v *ImageView) GetName() string

func (*ImageView) OnDraw

func (v *ImageView) OnDraw(ctx engine.DrawingContext)

func (*ImageView) SetImageUrl added in v0.1.1

func (v *ImageView) SetImageUrl(url string)

Sets the image url equal to the specified value, forcing the view to redraw and requesting rendering.

func (*ImageView) SetResId added in v0.1.7

func (v *ImageView) SetResId(i a.ResId)

Sets the resource index equal to the specified value, forcing the view to redraw and requesting rendering.

type MouseMover

type MouseMover struct {
	engine.ComponentImpl
	// contains filtered or unexported fields
}

func NewMouseMover

func NewMouseMover() *MouseMover

func (*MouseMover) GetName

func (m *MouseMover) GetName() string

func (*MouseMover) OnStart

func (m *MouseMover) OnStart()

func (*MouseMover) OnStop

func (m *MouseMover) OnStop()

func (*MouseMover) OnUpdate

func (m *MouseMover) OnUpdate(_ engine.UpdateContext)

type NativeInputView added in v0.1.1

type NativeInputView struct {
	engine.ComponentImpl
	// contains filtered or unexported fields
}

Component displays a native input widget for current platform.

func NewNativeInputView added in v0.1.1

func NewNativeInputView(values ...string) *NativeInputView

Creates a new NativeInputView. Returns pointer to the instance. This function takes a set of parameters to initialize the input view. All of them are optional. The parameters are in the following order: 0 - initial text 1 - initial hint Further values are ignored.

func (*NativeInputView) ForceRedraw added in v0.1.1

func (n *NativeInputView) ForceRedraw()

func (*NativeInputView) GetHint added in v0.1.1

func (n *NativeInputView) GetHint() string

Returns the current hint value of the input view.

func (*NativeInputView) GetName added in v0.1.1

func (n *NativeInputView) GetName() string

func (*NativeInputView) GetText added in v0.1.1

func (n *NativeInputView) GetText() string

Returns the current text value of the input view.

func (*NativeInputView) OnDraw added in v0.1.1

func (n *NativeInputView) OnDraw(ctx engine.DrawingContext)

func (*NativeInputView) OnInit added in v0.1.1

func (n *NativeInputView) OnInit(ctx engine.InitContext)

func (*NativeInputView) OnStart added in v0.1.1

func (n *NativeInputView) OnStart()

func (*NativeInputView) OnStop added in v0.1.1

func (n *NativeInputView) OnStop()

func (*NativeInputView) SetHint added in v0.1.1

func (n *NativeInputView) SetHint(hint string)

Updates the hint text of the input view.

func (*NativeInputView) SetOnTextChangeListener added in v0.1.1

func (n *NativeInputView) SetOnTextChangeListener(listener func(text string))

Sets the callback that is invoked when the text of the input view is changed.

func (*NativeInputView) SetText added in v0.1.1

func (n *NativeInputView) SetText(text string)

Updates the text.

type OnClickListener

type OnClickListener struct {
	engine.ComponentImpl
	OnClick engine.EventHandler `state:"onClick"`
}

OnClickListener detects clicks on the scene object and calls the specified engine.EventHandler. For click detection to work remember to add a component that implements engine.BoundaryComponent to the scene object.

func NewOnClickListener

func NewOnClickListener(handler engine.EventHandler) *OnClickListener

Creates a new OnClickListener component with the specified event handler.

func (*OnClickListener) GetName

func (l *OnClickListener) GetName() string

func (*OnClickListener) OnMessage

func (l *OnClickListener) OnMessage(m engine.Message) bool

type OnSelectHandler

type OnSelectHandler func(item string)

type RectBoundary

type RectBoundary struct {
	engine.ComponentImpl
}

func NewRectBoundary

func NewRectBoundary() *RectBoundary

func (*RectBoundary) GetName

func (r *RectBoundary) GetName() string

func (*RectBoundary) IsPointInside

func (r *RectBoundary) IsPointInside(point a.Vector3) bool

func (*RectBoundary) IsPointInside2D

func (r *RectBoundary) IsPointInside2D(point a.Vector3) bool

type ShapeView

type ShapeView struct {
	engine.ViewImpl
	FillColor    a.Color `state:"fillColor"`
	StrokeColor  a.Color `state:"strokeColor"`
	StrokeWeight byte    `state:"strokeWeight"`
	CornerRadius byte    `state:"cornerRadius"`
	PType        byte    `state:"pType"`
}

Displays a basic shape: rectangle, ellipse, triangle, line, point.

func NewShapeView

func NewShapeView(pType ShapeType) *ShapeView

func (*ShapeView) GetName

func (c *ShapeView) GetName() string

func (*ShapeView) OnDraw

func (c *ShapeView) OnDraw(ctx engine.DrawingContext)

type TextView

type TextView struct {
	engine.ViewImpl
	TextColor  a.Color     `state:"textColor"`
	Font       string      `state:"font"`
	FontSize   byte        `state:"fontSize"`
	FontWeight byte        `state:"fontWeight"`
	Text       string      `state:"text"`
	HTextAlign a.TextAlign `state:"hTextAlign"`
	VTextAlign a.TextAlign `state:"vTextAlign"`
}

Component for displaying text

func NewTextView

func NewTextView(text string) *TextView

func (*TextView) GetName

func (t *TextView) GetName() string

func (*TextView) GetText

func (t *TextView) GetText() string

Returns the current text value.

func (*TextView) OnDraw

func (t *TextView) OnDraw(ctx engine.DrawingContext)

func (*TextView) SetFontSize added in v0.1.7

func (t *TextView) SetFontSize(fontSize byte)

Sets the current text size.

func (*TextView) SetHTextAlign added in v0.1.7

func (t *TextView) SetHTextAlign(align a.TextAlign)

Sets the current horizontal text alignment.

func (*TextView) SetText

func (t *TextView) SetText(text string)

Sets the text equal to the specified value, forcing the view to redraw and requesting rendering.

func (*TextView) SetTextColor added in v0.1.7

func (t *TextView) SetTextColor(color interface{})

Sets the current text color.

func (*TextView) SetVTextAlign added in v0.1.7

func (t *TextView) SetVTextAlign(align a.TextAlign)

Sets the current horizontal text alignment.

type TriangleBoundary

type TriangleBoundary struct {
	// contains filtered or unexported fields
}

func NewTriangleBoundary

func NewTriangleBoundary() *TriangleBoundary

func (*TriangleBoundary) GetName

func (r *TriangleBoundary) GetName() string

func (*TriangleBoundary) IsPointInside

func (r *TriangleBoundary) IsPointInside(_ a.Vector3) bool

func (*TriangleBoundary) IsPointInside2D

func (r *TriangleBoundary) IsPointInside2D(point a.Vector3) bool

func (*TriangleBoundary) OnInit

func (r *TriangleBoundary) OnInit(ctx engine.InitContext)

func (*TriangleBoundary) OnStart

func (r *TriangleBoundary) OnStart()

func (*TriangleBoundary) OnStop

func (r *TriangleBoundary) OnStop()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL