yagk

package module
v0.0.0-...-76ca5d0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2021 License: MIT Imports: 15 Imported by: 0

README

Yet Another Graphical toolKit

A very opinionated GUI toolkit with the most basic style definition possible.

Useful to build a quick multiplatform (linux, win & macos) desktop app.

Basic Example

package main

import (
	"github.com/enimatek-nl/yagk"
	"os"
)

func main() {
	app := yagk.New("My App", 512, 512)

	style := yagk.NewStyle(&yagk.StyleDefinition{})
	
	pane := yagk.NewPane(0, 0, app.Width, style)

	pane.Button(
		"Quit",
		func() {
			os.Exit(1)
		},
	)
	
	app.PushPane(pane)
	
	app.Run()
}

Documentation

Index

Constants

View Source
const (
	AlignLeft   Alignment = 0
	AlignCenter Alignment = 1
	AlignRight  Alignment = 2

	OrientHorizontal Orientation = 0
	OrientVertical   Orientation = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Alignment

type Alignment int

type Button

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

type Checkbox

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

func (*Checkbox) Draw

func (c *Checkbox) Draw(canvas *ebiten.Image, win *Window)

func (*Checkbox) Translate

func (c *Checkbox) Translate(x, y int)

func (*Checkbox) Update

func (c *Checkbox) Update(io *IO)

type Container

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

func (*Container) Draw

func (c *Container) Draw(canvas *ebiten.Image, win *Window)

func (*Container) Translate

func (c *Container) Translate(x, y int)

func (*Container) Update

func (c *Container) Update(io *IO)

type Font

type Font struct {
	Color  color.Color
	Button color.Color
	Data   []byte
	Size   float64
	DPI    float64
}

type IO

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

type Icon

type Icon struct {
	Scale float64
	// contains filtered or unexported fields
}

func (*Icon) Draw

func (i *Icon) Draw(canvas *ebiten.Image, win *Window)

func (*Icon) Translate

func (i *Icon) Translate(x, y int)

func (*Icon) Update

func (i *Icon) Update(io *IO)

type Icons

type Icons struct {
	Data    []byte
	Size    int
	Scale   float64
	Columns int
}

type Input

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

func (*Input) Draw

func (i *Input) Draw(canvas *ebiten.Image, win *Window)

func (*Input) Translate

func (i *Input) Translate(x, y int)

func (*Input) Update

func (i *Input) Update(io *IO)

type Label

type Label struct {
	Color     color.Color
	Alignment Alignment
	// contains filtered or unexported fields
}

func (*Label) Draw

func (l *Label) Draw(canvas *ebiten.Image, win *Window)

func (*Label) Translate

func (l *Label) Translate(x, y int)

func (*Label) Update

func (l *Label) Update(io *IO)

type ListItem

type ListItem struct {
	Text, BtnText string
	IconId        int
	// contains filtered or unexported fields
}

type Mouse

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

type Orientation

type Orientation int

type Pane

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

func NewPane

func NewPane(x, y, w int, style *Style) (p *Pane)

func (*Pane) Button

func (p *Pane) Button(label string, action func()) *Pane

func (*Pane) Checkbox

func (p *Pane) Checkbox(label string, checked *bool) *Pane

func (*Pane) Confirm

func (p *Pane) Confirm(label1 string, action1 func(), label2 string, action2 func()) *Pane

func (*Pane) Draw

func (p *Pane) Draw(canvas *ebiten.Image, win *Window)

func (*Pane) Height

func (p *Pane) Height() int

func (*Pane) IconText

func (p *Pane) IconText(iconId int, text string) *Pane

func (*Pane) Input

func (p *Pane) Input(text *string) *Pane

func (*Pane) List

func (p *Pane) List(listItems []ListItem, inView int, action func(index int)) *Pane

func (*Pane) ProgressBar

func (p *Pane) ProgressBar(total int, progress *int) *Pane

func (*Pane) Selection

func (p *Pane) Selection(label string, selected *int, items ...string) *Pane

func (*Pane) Text

func (p *Pane) Text(text string) *Pane

func (*Pane) Update

func (p *Pane) Update(io *IO)

type Pos

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

type Progress

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

func (*Progress) Draw

func (p *Progress) Draw(canvas *ebiten.Image, win *Window)

func (*Progress) Translate

func (p *Progress) Translate(x, y int)

func (*Progress) Update

func (p *Progress) Update(io *IO)

type Size

type Size struct {
	X, Y int
}

type Slider

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

func (*Slider) Draw

func (s *Slider) Draw(canvas *ebiten.Image, win *Window)

func (*Slider) Translate

func (s *Slider) Translate(x, y int)

func (*Slider) Update

func (s *Slider) Update(io *IO)

type Style

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

func NewStyle

func NewStyle(def *StyleDefinition) (s *Style)

type StyleDefinition

type StyleDefinition struct {
	Offset     Size
	Sizes      Size
	Font       Font
	Icons      Icons
	Background color.Color
	Data       []byte
	Size       int
}

type Widget

type Widget interface {
	Update(io *IO)
	Draw(canvas *ebiten.Image, win *Window)
	Translate(x, y int)
}

type WidgetId

type WidgetId int

type WidgetState

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

type Window

type Window struct {
	Width, Height int
	// contains filtered or unexported fields
}

func New

func New(title string, width, height int) (win *Window)

func (*Window) Draw

func (win *Window) Draw(screen *ebiten.Image)

func (*Window) GetPane

func (win *Window) GetPane(i int) (p *Pane)

func (*Window) Layout

func (win *Window) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Window) PopPane

func (win *Window) PopPane() bool

func (*Window) PushPane

func (win *Window) PushPane(p *Pane)

func (*Window) Run

func (win *Window) Run()

func (*Window) Update

func (win *Window) Update() error

Jump to

Keyboard shortcuts

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