gadgetSimUi

package
v0.1.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: MIT Imports: 6 Imported by: 1

Documentation

Overview

This sub library is for simulating gadgets on desktop Supports keys and monochrome display.

Rough but can help when developing ui and button layout for gadget.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ButtonSettings

type ButtonSettings struct {
	ID         string    `json:"id"` //Can have duplicates like control and control :D
	Corner     XyIntPair `json:"corner"`
	Dimensions XyIntPair `json:"dimensions,omitempty"`

	DebugEdges bool //should print debug edges for checking placement
	DebugColor color.RGBA
}

func (*ButtonSettings) Hits

func (p *ButtonSettings) Hits(x int, y int) bool

type DisplayUpdate

type DisplayUpdate struct {
	ID     string
	Bitmap gomonochromebitmap.MonoBitmap
}

type GadgetWindow

type GadgetWindow struct {
	Title string
	//ImageFile    string
	MonoDisplays []MonochromeDisplay
	Buttons      []ButtonSettings

	BgImage image.Image //image.RGBA

	FromKeys  chan KeyboardStatus
	ToDisplay chan DisplayUpdate
	// contains filtered or unexported fields
}

func (*GadgetWindow) HitsToId

func (p *GadgetWindow) HitsToId(x int, y int) string

func (*GadgetWindow) Initialize

func (p *GadgetWindow) Initialize(backgroundPicture image.Image) error

Assuming that background image stays same and LCD/OLED display is static

func (*GadgetWindow) Quit

func (p *GadgetWindow) Quit()

func (*GadgetWindow) Render

func (p *GadgetWindow) Render() error

Render if content changes or window resizes

func (*GadgetWindow) Run

func (p *GadgetWindow) Run() error

func (*GadgetWindow) ScaleWinOnPicCoord

func (p *GadgetWindow) ScaleWinOnPicCoord(x int, y int) (int, int)

type KeyboardStatus

type KeyboardStatus struct {
	KeysDown []string //array if multitouch support
}

type MonochromeDisplay

type MonochromeDisplay struct {
	Bitmap      gomonochromebitmap.MonoBitmap
	ID          string     `json:"id"`
	Corner      XyIntPair  `json:"corner"` //Coordinate on bitmap
	PixelSize   XyIntPair  `json:"pixelSize"`
	PixelGap    XyIntPair  `json:"pixelGap"`
	UpperRows   int        `json:"upperRows"`   //Allows to simulate two color OLED displays with 8 rows up or down with yellow and others are blue
	OnColor     color.RGBA `json:"onColor"`     //Hex format with transparent, upper rows
	OnColorDown color.RGBA `json:"onColorDown"` //Hex format with transparent
	OffColor    color.RGBA `json:"offColor"`    //Hex format with transparent
}

type XyIntPair

type XyIntPair struct {
	X int `json:"x"`
	Y int `json:"y"`
}

Jump to

Keyboard shortcuts

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