gumi

package module
v0.0.0-...-e720886 Latest Latest
Warning

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

Go to latest
Published: May 25, 2018 License: BSD-3-Clause Imports: 24 Imported by: 4

README

gumi

GUMI lightweight, simple, fast GUI rendering library for Go

Documentation

Overview

gumi.go define GUMI interface GUMI is elements of GUI Every elements can render(graphic), affect(event), update(information) must implements this interface

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrorRequestSchema = errors.Resize("Schema error")
	ErrorNotNil         = errors.New("Not allow nil to this")
	ErrorNameConflict   = errors.New("Name conflict")
	ErrorParsingFail    = errors.New("Parsing failure")
	ErrorCantParse      = errors.New("Can't parse value")
	ErrorNotControlable = errors.New("Can't control value name")
	ErrorNotFound       = errors.New("Can't find")
	ErrorViolation      = errors.New("Rule Violate")
	ErrorInvalidValue   = errors.New("needRender value")
)
View Source
var (
	CriticalUnknownBehavior = errors.New("Unknown behavior")
)

Functions

func ListStringStyleData

func ListStringStyleData() []string

func TextComplete

func TextComplete(s string, r rune) string

func WorkingPipe

func WorkingPipe(pipe *Pipe, works ...RecursiveJob) error

func WorkingPipeSynchronized

func WorkingPipeSynchronized(pipe *Pipe, works ...RecursiveJob) error

Types

type Bounder

type Bounder interface {
	RelayBound() image.Rectangle

	GetBound() image.Rectangle
	RequestResize()
	// contains filtered or unexported methods
}

type CircleShape

type CircleShape struct {
	Center image.Point
	Radius int
}

func NewCircleShape

func NewCircleShape(center image.Point, radius int) *CircleShape

func (*CircleShape) In

func (s *CircleShape) In(point image.Point) bool

type Clicker

type Clicker interface {
	Click(ispress bool)
}

Handling

type ComplexShape

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

func NewComplexShape

func NewComplexShape(shapers ...Shaper) *ComplexShape

func (*ComplexShape) Append

func (s *ComplexShape) Append(shapers ...Shaper)

func (*ComplexShape) Clear

func (s *ComplexShape) Clear()

func (*ComplexShape) In

func (s *ComplexShape) In(point image.Point) bool

type DefaultManager

type DefaultManager interface {
	GetDefault() gime.Value
	SetDefault(v gime.Value) error
}

type DoRender

type DoRender interface {
	DoRender(q *giame.ContourQuary) []*giame.Contour
	// Cache related
	Throw()
	Done()
	Valid() bool
	Bounder
}

type Document

type Document struct {
	Version verGo.Version
}

func (*Document) String

func (s *Document) String() string

type Editer

type Editer interface {
	Edit(current string, completed string, editing rune)
}

Handling

type Event

type Event interface {
	Kind() EventKind
}

type EventCursor

type EventCursor struct {
	image.Point
}

func (EventCursor) Kind

func (EventCursor) Kind() EventKind

func (EventCursor) ToPoint

func (s EventCursor) ToPoint() image.Point

Utils

type EventKeyPress

type EventKeyPress struct {
	Key GUMIKey
}

func (EventKeyPress) Kind

func (EventKeyPress) Kind() EventKind

type EventKeyRelease

type EventKeyRelease struct {
	Key GUMIKey
}

func (EventKeyRelease) Kind

func (EventKeyRelease) Kind() EventKind

type EventKind

type EventKind uint8
const (
	EVENT_KEYPRESS     EventKind = iota
	EVENT_KEYRELEASE   EventKind = iota
	EVENT_CURSOR       EventKind = iota
	EVENT_SCROLL       EventKind = iota
	EVENT_RUNECOMPLETE EventKind = iota
	EVENT_RUNEEDIT     EventKind = iota
	EVENT_TICK         EventKind = iota
	EVENT_RESIZE       EventKind = iota
	EVENT_STYLE        EventKind = iota
)

type EventResize

type EventResize struct {
	Bound image.Rectangle
}

func (EventResize) Kind

func (EventResize) Kind() EventKind

type EventRuneComplete

type EventRuneComplete struct {
	Rune rune
}

func (EventRuneComplete) Kind

type EventRuneEdit

type EventRuneEdit struct {
	Rune rune
}

func (EventRuneEdit) Kind

func (EventRuneEdit) Kind() EventKind

type EventScroll

type EventScroll struct {
	image.Point
}

func (EventScroll) Kind

func (EventScroll) Kind() EventKind

type EventStyle

type EventStyle struct {
	StyleData StyleData
}

func (EventStyle) Kind

func (EventStyle) Kind() EventKind

type EventTick

type EventTick struct {
	DeltaT time.Duration
}

func (EventTick) Kind

func (EventTick) Kind() EventKind

type Focuser

type Focuser interface {
	Focus(focus bool)
}

Handling

type GUMI

type GUMI interface {
	MaxChildrun() int
	Pipe() *Pipe

	fmt.Stringer
	// contains filtered or unexported methods
}

GUMI is a collection of basic elements

type GUMIKey

type GUMIKey uint8
const (
	KEY_UNKNOWN GUMIKey = iota
	// Alphabet
	KEY_A GUMIKey = iota
	KEY_B GUMIKey = iota
	KEY_C GUMIKey = iota
	KEY_D GUMIKey = iota
	KEY_E GUMIKey = iota
	KEY_F GUMIKey = iota
	KEY_G GUMIKey = iota
	KEY_H GUMIKey = iota
	KEY_I GUMIKey = iota
	KEY_J GUMIKey = iota
	KEY_K GUMIKey = iota
	KEY_L GUMIKey = iota
	KEY_M GUMIKey = iota
	KEY_N GUMIKey = iota
	KEY_O GUMIKey = iota
	KEY_P GUMIKey = iota
	KEY_Q GUMIKey = iota
	KEY_R GUMIKey = iota
	KEY_S GUMIKey = iota
	KEY_T GUMIKey = iota
	KEY_U GUMIKey = iota
	KEY_V GUMIKey = iota
	KEY_W GUMIKey = iota
	KEY_X GUMIKey = iota
	KEY_Y GUMIKey = iota
	KEY_Z GUMIKey = iota
	// Number
	KEY_0 GUMIKey = iota
	KEY_1 GUMIKey = iota
	KEY_2 GUMIKey = iota
	KEY_3 GUMIKey = iota
	KEY_4 GUMIKey = iota
	KEY_5 GUMIKey = iota
	KEY_6 GUMIKey = iota
	KEY_7 GUMIKey = iota
	KEY_8 GUMIKey = iota
	KEY_9 GUMIKey = iota
	// Special
	KEY_BACKQUOTE    GUMIKey = iota // `
	KEY_APOSTROPHE   GUMIKey = iota // '
	KEY_LEFTBRACKET  GUMIKey = iota // [
	KEY_RIGHTBRACKET GUMIKey = iota // ]
	KEY_SEMICOLON    GUMIKey = iota // ;
	KEY_MINUS        GUMIKey = iota // -
	KEY_EQUAL        GUMIKey = iota // =
	KEY_BACKSLASH    GUMIKey = iota // \
	KEY_SLASH        GUMIKey = iota // /
	KEY_COMMA        GUMIKey = iota // ,
	KEY_PERIOD       GUMIKey = iota // .
	// Function
	KEY_F1  GUMIKey = iota
	KEY_F2  GUMIKey = iota
	KEY_F3  GUMIKey = iota
	KEY_F4  GUMIKey = iota
	KEY_F5  GUMIKey = iota
	KEY_F6  GUMIKey = iota
	KEY_F7  GUMIKey = iota
	KEY_F8  GUMIKey = iota
	KEY_F9  GUMIKey = iota
	KEY_F10 GUMIKey = iota
	KEY_F11 GUMIKey = iota
	KEY_F12 GUMIKey = iota
	// Control
	KEY_ESCAPE    GUMIKey = iota
	KEY_BACKSPACE GUMIKey = iota
	KEY_DELETE    GUMIKey = iota
	KEY_SPACE     GUMIKey = iota
	KEY_ENTER     GUMIKey = iota
	KEY_SHIFT     GUMIKey = iota // mac : Shift
	KEY_CONTROL   GUMIKey = iota // mac : Command, Control
	KEY_ALT       GUMIKey = iota // mac : Option
	KEY_TAB       GUMIKey = iota
	// Arrow
	KEY_UP    GUMIKey = iota
	KEY_DOWN  GUMIKey = iota
	KEY_LEFT  GUMIKey = iota
	KEY_RIGHT GUMIKey = iota
	// Mouse
	KEY_MOUSE1 GUMIKey = iota
	KEY_MOUSE2 GUMIKey = iota
	KEY_MOUSE3 GUMIKey = iota
)

func (GUMIKey) String

func (s GUMIKey) String() string

type Handler

type Handler interface {
	PreHandle(event Event) Event
	Handle(event Event)
}

type Information

type Information struct {
	Dt int64
}

func DefaultInformation

func DefaultInformation() *Information

type MLGBuilder

type MLGBuilder struct {

	// setting data
	PrintComment  bool
	Verbose       bool
	IgnoreWarning bool
	// contains filtered or unexported fields
}

func NewMLGBuilder

func NewMLGBuilder(r io.Reader, space *Space) (*MLGBuilder, error)

func (*MLGBuilder) Build

func (s *MLGBuilder) Build() (*Screen, error)

type MLGResourceLocation

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

func (*MLGResourceLocation) Data

func (s *MLGResourceLocation) Data() gime.Value

func (*MLGResourceLocation) ID

func (s *MLGResourceLocation) ID() string

func (*MLGResourceLocation) Mime

func (s *MLGResourceLocation) Mime() string

type MLGResourceMemory

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

func (*MLGResourceMemory) Data

func (s *MLGResourceMemory) Data() gime.Value

func (*MLGResourceMemory) ID

func (s *MLGResourceMemory) ID() string

func (*MLGResourceMemory) Mime

func (s *MLGResourceMemory) Mime() string

type MLGResourceStore

type MLGResourceStore interface {
	ID() string
	Mime() string
	Data() gime.Value
}

type Meta

type Meta struct {
	Title       string
	Description string

	Framerate gcore.Framerate
	Locale    string
	// contains filtered or unexported fields
}

func (*Meta) SetSize

func (s *Meta) SetSize(size gcore.FixedSize)

func (*Meta) Size

func (s *Meta) Size() gcore.FixedSize

func (*Meta) String

func (s *Meta) String() string

type ParentBounder

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

func (*ParentBounder) GetBound

func (s *ParentBounder) GetBound() image.Rectangle

do not override

func (*ParentBounder) RelayBound

func (s *ParentBounder) RelayBound() image.Rectangle

if need, override

func (*ParentBounder) RequestResize

func (s *ParentBounder) RequestResize()

do not override

type ParentDoRender

type ParentDoRender struct {
	ParentBounder
	// contains filtered or unexported fields
}

func (*ParentDoRender) Done

func (s *ParentDoRender) Done()

do not override

func (*ParentDoRender) Throw

func (s *ParentDoRender) Throw()

do not override

func (*ParentDoRender) Valid

func (s *ParentDoRender) Valid() bool

do not override

type ParentGUMI

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

func (*ParentGUMI) Pipe

func (s *ParentGUMI) Pipe() *Pipe

func (*ParentGUMI) Pipeline

func (s *ParentGUMI) Pipeline() *Pipeline

func (*ParentGUMI) Screen

func (s *ParentGUMI) Screen() *Screen

type Pipe

type Pipe struct {
	Pipeline *Pipeline
	Parent   *Pipe
	Childrun []*Pipe
	//
	Elem GUMI
	// contains filtered or unexported fields
}

func (*Pipe) GetStyle

func (s *Pipe) GetStyle(data StyleData) interface{}

func (*Pipe) ListStyle

func (s *Pipe) ListStyle(each func(sdata StyleData, value interface{}))

func (*Pipe) ProximateChildrunSize

func (s *Pipe) ProximateChildrunSize() []*gcore.Size

func (*Pipe) ProximateParentBound

func (s *Pipe) ProximateParentBound() image.Rectangle

func (*Pipe) SetStyle

func (s *Pipe) SetStyle(data StyleData, value interface{}) bool

type Pipeline

type Pipeline struct {
	//Eventline  *etc.Manager
	Screen *Screen
	Root   *Pipe
	// contains filtered or unexported fields
}

func NewPipeline

func NewPipeline(Screen *Screen) *Pipeline

func (*Pipeline) New

func (s *Pipeline) New(parent *Pipe, elem GUMI) *Pipe

func (*Pipeline) Rasterizer

func (s *Pipeline) Rasterizer(dr giame.Driver, rasterzier, postRasterizer giame.Result)

func (*Pipeline) Rendering

func (s *Pipeline) Rendering()

type PostRender

type PostRender interface {
	PostRender(rasterzier *giame.ContourQuary) []*giame.Contour
}

type PreFocuser

type PreFocuser interface {
	PreFocus(event Event, focus bool) Event
}

PreHandling

type PreRawHandler

type PreRawHandler interface {
	PreHandle(event Event) Event
}

PreHandling

type RawHandler

type RawHandler interface {
	Handle(event Event)
}

Handling

type RectShape

type RectShape struct {
	Bound image.Rectangle
}

func NewRectShape

func NewRectShape(rect image.Rectangle) *RectShape

func (*RectShape) In

func (s *RectShape) In(point image.Point) bool

type RecursiveJob

type RecursiveJob func(pipe *Pipe) error

type Resizer

type Resizer interface {
	Resize(r image.Rectangle)
}

Handling

type Resource

type Resource struct {
	*gime.URISupportMap
	Inners []MLGResourceStore
}

func NewResource

func NewResource() *Resource

func (*Resource) Resource

func (s *Resource) Resource(path string) MLGResourceStore

type Screen

type Screen struct {
	Pipeline *Pipeline
	Meta     *Meta
	Resource *Resource
}

func NewScreen

func NewScreen() *Screen

type Scroller

type Scroller interface {
	Scroll(x, y int)
}

Handling

type Shaper

type Shaper interface {
	In(point image.Point) bool
}

type Sizer

type Sizer interface {
	Size() gcore.Size
}

type Space

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

func NewSpace

func NewSpace(supports ...SpaceSupport) (*Space, error)

func (*Space) Find

func (s *Space) Find(ns, name string) *SupportTag

func (*Space) Support

func (s *Space) Support(ns string, tag *SupportTag) error

type SpaceSupport

type SpaceSupport func(space *Space) error

type Style

type Style map[StyleData]interface{}

func DefaultStyle

func DefaultStyle() Style

type StyleData

type StyleData uint32

[0:16] : Identifier [16:32] : Style Datatype

const (
	STYLE_INVALID StyleData = iota
	//
	STYLE_Background StyleData = (iota << 16) | StyleData(TYPE_TEXTURE)
	//
	STYLE_LineWidth StyleData = (iota << 16) | StyleData(TYPE_INT)
	//
	STYLE_Font       StyleData = (iota << 16) | StyleData(TYPE_FONT)
	STYLE_TextColor  StyleData = (iota << 16) | StyleData(TYPE_COLOR)
	STYLE_TextHeight StyleData = (iota << 16) | StyleData(TYPE_INT)
	STYLE_TextAlign  StyleData = (iota << 16) | StyleData(TYPE_ALIGN)
)

func FromStringStyleData

func FromStringStyleData(s string) StyleData

func (StyleData) String

func (s StyleData) String() string

func (StyleData) Type

func (s StyleData) Type() StyleDatatype

type StyleDatatype

type StyleDatatype uint16
const (
	TYPE_NIL       StyleDatatype = iota
	TYPE_INT       StyleDatatype = iota
	TYPE_FLOAT     StyleDatatype = iota
	TYPE_STRING    StyleDatatype = iota
	TYPE_SIZE      StyleDatatype = iota
	TYPE_FIXEDSIZE StyleDatatype = iota
	TYPE_BLANK     StyleDatatype = iota
	TYPE_ALIGN     StyleDatatype = iota
	TYPE_AXIS      StyleDatatype = iota
	TYPE_COLOR     StyleDatatype = iota
	TYPE_FONT      StyleDatatype = iota
	TYPE_TEXTURE   StyleDatatype = iota
)

func (StyleDatatype) Marshal

func (s StyleDatatype) Marshal(value interface{}) (string, error)

func (StyleDatatype) Unmarshal

func (s StyleDatatype) Unmarshal(value string) (interface{}, error)

func (StyleDatatype) Valid

func (s StyleDatatype) Valid(value interface{}) bool

type Styler

type Styler interface {
	Style(data StyleData)
}

Handling

type SupportTag

type SupportTag struct {
	Name string
	New  func() GUMI
}

type TagArg

type TagArg struct {
	Name  string
	SetFn func(gumi GUMI, value string) error
	GetFn func(gumi GUMI) (string, error)
}

type TextDeleteActor

type TextDeleteActor struct {
	Thershold float64
	Interval  float64
	// contains filtered or unexported fields
}

func NewTextDeleteActor

func NewTextDeleteActor(Thershold float64, Interval float64) *TextDeleteActor

func (*TextDeleteActor) Animate

func (s *TextDeleteActor) Animate(delta float64) bool

func (*TextDeleteActor) Pop

func (s *TextDeleteActor) Pop() int

func (*TextDeleteActor) Reset

func (s *TextDeleteActor) Reset()

func (*TextDeleteActor) Start

func (s *TextDeleteActor) Start()

type Ticker

type Ticker interface {
	Tick(t time.Duration)
}

Handling

type ValueManager

type ValueManager interface {
	ListValue() []string
	GetValue(t string) gime.Value
	SetValue(t string, v gime.Value) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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