bmo

package
v0.0.0-...-e58d8b8 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value, a, b int) int

Clamp clamps "value" between a, b range.

func Clampf

func Clampf(value, a, b float32) float32

Clamp clamps "value" between a, b range.

Types

type Component

type Component struct {
	Rect  sdl.Rect
	Color RGBColor
	// contains filtered or unexported fields
}

Component struct.

func NewComponent

func NewComponent(rect sdl.Rect, color RGBColor) *Component

func (*Component) Contains

func (c *Component) Contains(point Point) bool

func (*Component) Draw

func (c *Component) Draw(renderer *sdl.Renderer)

func (*Component) OnMouseMoved

func (c *Component) OnMouseMoved(callback OnMouseEventCallback)

func (*Component) OnMousePressed

func (c *Component) OnMousePressed(callback OnMouseEventCallback)

func (*Component) OnMouseReleased

func (c *Component) OnMouseReleased(callback OnMouseEventCallback)

func (*Component) Show

func (c *Component) Show(visible bool)

func (*Component) TriggerOnMouseMoved

func (c *Component) TriggerOnMouseMoved(p Point)

func (*Component) TriggerOnMousePressed

func (c *Component) TriggerOnMousePressed(p Point)

func (*Component) TriggerOnMouseReleased

func (c *Component) TriggerOnMouseReleased(p Point)

type Devices

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

Devices list.

func NewDevices

func NewDevices() *Devices

NewDevices inits device container.

func (*Devices) BulbsBrightness

func (d *Devices) BulbsBrightness(value int)

BulbsBrightness sets brightness for all bulbs.

func (*Devices) BulbsColor

func (d *Devices) BulbsColor(r, g, b uint8)

BulbsColor sets color for all bulbs.

func (*Devices) BulbsPower

func (d *Devices) BulbsPower(on bool)

BulbsPower powers on/off all bulbs.

func (*Devices) RegisterYeeBulb

func (d *Devices) RegisterYeeBulb(addr string)

RegisterYeeBulb adds yee light.

type IComponent

type IComponent interface {
	Draw(renderer *sdl.Renderer)
	Contains(point Point) bool
	Show(visible bool)

	// mouse support
	OnMousePressed(callback OnMouseEventCallback)
	OnMouseMoved(callback OnMouseEventCallback)
	OnMouseReleased(callback OnMouseEventCallback)
	TriggerOnMousePressed(p Point)
	TriggerOnMouseMoved(p Point)
	TriggerOnMouseReleased(p Point)
}

type MouseEvent

type MouseEvent struct {
	GP Point // global
	LP Point // local
}

type OnChangeSliderCallback

type OnChangeSliderCallback func(color RGBColor, brightness int)

type OnMouseEventCallback

type OnMouseEventCallback func(event MouseEvent)

type Point

type Point struct {
	X int32
	Y int32
}

func (Point) IsInside

func (p Point) IsInside(rect *sdl.Rect) bool

type RGBColor

type RGBColor struct {
	R uint8
	G uint8
	B uint8
	A uint8
}

func RGB

func RGB(r, g, b uint8) RGBColor

type Screen

type Screen struct {
	Rect sdl.Rect
}

func (*Screen) Position

func (s *Screen) Position(x, y int32) Point

Position calculates screen position.

func (*Screen) TouchPosition

func (s *Screen) TouchPosition(x, y float32) Point

type SliderGroup

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

Component struct.

func NewSliderGroup

func NewSliderGroup(rect sdl.Rect, color RGBColor) *SliderGroup

func (*SliderGroup) Contains

func (sg *SliderGroup) Contains(point Point) bool

func (*SliderGroup) Draw

func (sg *SliderGroup) Draw(renderer *sdl.Renderer)

func (*SliderGroup) OnChange

func (sg *SliderGroup) OnChange(callback OnChangeSliderCallback)

func (*SliderGroup) OnMouseMoved

func (sg *SliderGroup) OnMouseMoved(callback OnMouseEventCallback)

func (*SliderGroup) OnMousePressed

func (sg *SliderGroup) OnMousePressed(callback OnMouseEventCallback)

func (*SliderGroup) OnMouseReleased

func (sg *SliderGroup) OnMouseReleased(callback OnMouseEventCallback)

func (*SliderGroup) Show

func (sg *SliderGroup) Show(visible bool)

func (*SliderGroup) TriggerOnMouseMoved

func (sg *SliderGroup) TriggerOnMouseMoved(p Point)

func (*SliderGroup) TriggerOnMousePressed

func (sg *SliderGroup) TriggerOnMousePressed(p Point)

func (*SliderGroup) TriggerOnMouseReleased

func (sg *SliderGroup) TriggerOnMouseReleased(p Point)

type YeeBulb

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

YeeBulb data.

func NewYeeBulb

func NewYeeBulb(ip string) *YeeBulb

NewYeeBulb creates a new yee based on IP.

func (*YeeBulb) Brightness

func (y *YeeBulb) Brightness(value int)

Brightness sets bright parameter.

func (*YeeBulb) Color

func (y *YeeBulb) Color(r, g, b uint8)

Color sets RGB color.

func (*YeeBulb) Power

func (y *YeeBulb) Power(on bool)

Power toggles bulb on/off.

type YeeCmd

type YeeCmd struct {
	ID     int64      `json:"id"`
	Method string     `json:"method"`
	Params []yeeParam `json:"params"`
}

YeeCmd json.

type YeeError

type YeeError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

YeeError struct.

type YeeResponse

type YeeResponse struct {
	ID     int64    `json:"id"`
	Result []string `json:"result"`
	Error  YeeError `json:"error"`
}

YeeResponse struct.

Jump to

Keyboard shortcuts

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