rlyeh

package module
v0.0.0-...-4df799c Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2020 License: Zlib Imports: 10 Imported by: 0

README

TravisCI Build Status

Fork of https://github.com/gen2brain/raylib-go/tree/master/raygui

  • New object-oriented API
  • New automatic layout containers (HBox, VBox)
  • New Application, Dialog, Notification
  • Fixed Textbox
  • Fixed Combobox

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Notify

func Notify(duration time.Duration, format string, params ...interface{})

Types

type Align

type Align int32
const (
	Auto Align = iota
	Top
	Bottom
	Left
	Right
	Center
)

type Animation

type Animation struct {
	Texture rl.Texture2D
	// contains filtered or unexported fields
}

func NewAnimation

func NewAnimation(texture rl.Texture2D, point rl.Vector2, size Size, frameCount byte) *Animation

func (*Animation) Get

func (self *Animation) Get(frame byte) rl.Rectangle

type Application

type Application struct {
	Title string

	Width  int
	Height int
	// contains filtered or unexported fields
}

func GetApplication

func GetApplication() *Application

func NewApplication

func NewApplication(width, height int, title string) *Application

func (*Application) Add

func (self *Application) Add(form Form)

func (*Application) Close

func (self *Application) Close()

func (*Application) GetBounds

func (self *Application) GetBounds() rl.Rectangle

func (*Application) GetOption

func (self *Application) GetOption(name string) interface{}

func (*Application) Remove

func (self *Application) Remove(form Form)

func (*Application) RemoveOption

func (self *Application) RemoveOption(name string)

func (*Application) Run

func (self *Application) Run()

func (*Application) SetOption

func (self *Application) SetOption(name string, value interface{})

type Button

type Button struct {
	Text string

	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill
	State  State

	Image rl.Texture2D

	OnClick func()
	// contains filtered or unexported fields
}

func NewButton

func NewButton(align Align, fill Fill, text string, onClick func()) *Button

func (*Button) Draw

func (self *Button) Draw()

func (*Button) GetAlign

func (self *Button) GetAlign() Align

func (*Button) GetBounds

func (self *Button) GetBounds() rl.Rectangle

func (*Button) GetDataSize

func (self *Button) GetDataSize() Size

func (*Button) GetFill

func (self *Button) GetFill() Fill

func (*Button) GetId

func (self *Button) GetId() int32

func (*Button) GetParent

func (self *Button) GetParent() Widget

func (*Button) SetBounds

func (self *Button) SetBounds(bounds rl.Rectangle)

func (*Button) SetId

func (self *Button) SetId(id int32)

func (*Button) SetParent

func (self *Button) SetParent(parent Widget)

func (*Button) Update

func (self *Button) Update(dt float32)

type Checkbox

type Checkbox struct {
	Text string

	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill

	Checked bool
	// contains filtered or unexported fields
}

func NewCheckbox

func NewCheckbox(align Align, fill Fill) *Checkbox

func (*Checkbox) Draw

func (self *Checkbox) Draw()

func (*Checkbox) GetAlign

func (self *Checkbox) GetAlign() Align

func (*Checkbox) GetBounds

func (self *Checkbox) GetBounds() rl.Rectangle

func (*Checkbox) GetDataSize

func (self *Checkbox) GetDataSize() Size

func (*Checkbox) GetFill

func (self *Checkbox) GetFill() Fill

func (*Checkbox) GetId

func (self *Checkbox) GetId() int32

func (*Checkbox) GetParent

func (self *Checkbox) GetParent() Widget

func (*Checkbox) SetBounds

func (self *Checkbox) SetBounds(bounds rl.Rectangle)

func (*Checkbox) SetId

func (self *Checkbox) SetId(id int32)

func (*Checkbox) SetParent

func (self *Checkbox) SetParent(parent Widget)

func (*Checkbox) Update

func (self *Checkbox) Update(dt float32)

type Combobox

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

func NewCombobox

func NewCombobox(align Align, fill Fill, items []string) *Combobox

func (*Combobox) Draw

func (self *Combobox) Draw()

func (*Combobox) GetAlign

func (self *Combobox) GetAlign() Align

func (*Combobox) GetBounds

func (self *Combobox) GetBounds() rl.Rectangle

func (*Combobox) GetDataSize

func (self *Combobox) GetDataSize() Size

func (*Combobox) GetFill

func (self *Combobox) GetFill() Fill

func (*Combobox) GetId

func (self *Combobox) GetId() int32

func (*Combobox) GetParent

func (self *Combobox) GetParent() Widget

func (*Combobox) SetBounds

func (self *Combobox) SetBounds(bounds rl.Rectangle)

func (*Combobox) SetId

func (self *Combobox) SetId(id int32)

func (*Combobox) SetParent

func (self *Combobox) SetParent(parent Widget)

func (*Combobox) Update

func (self *Combobox) Update(dt float32)

type Dialog

type Dialog struct {
	Title      string
	Decoration bool
	// contains filtered or unexported fields
}

func NewDialog

func NewDialog(bounds rl.Rectangle, title string) *Dialog

func NewOpenFileDialog

func NewOpenFileDialog(path string, callback func(item string)) *Dialog

func NewSaveFileDialog

func NewSaveFileDialog(path string, callback func(item string)) *Dialog

func OkCancel

func OkCancel(text string, onOk func()) *Dialog

func (*Dialog) Add

func (self *Dialog) Add(widget Widget)

func (*Dialog) Clear

func (self *Dialog) Clear()

func (*Dialog) Close

func (self *Dialog) Close()

func (*Dialog) Draw

func (self *Dialog) Draw()

func (*Dialog) GetBounds

func (self *Dialog) GetBounds() rl.Rectangle

func (*Dialog) GetDataSize

func (self *Dialog) GetDataSize() Size

func (*Dialog) IsActive

func (self *Dialog) IsActive() bool

func (*Dialog) IsModal

func (self *Dialog) IsModal() bool

func (*Dialog) IsMovable

func (self *Dialog) IsMovable() bool

func (*Dialog) Open

func (self *Dialog) Open()

func (*Dialog) SetActive

func (self *Dialog) SetActive(value bool)

func (*Dialog) SetBounds

func (self *Dialog) SetBounds(bounds rl.Rectangle)

func (*Dialog) Update

func (self *Dialog) Update(dt float32)

type Fill

type Fill int32
const (
	None Fill = iota
	Vertical
	Horizontal
	Both
)

type Form

type Form interface {
	Update(float32)
	Draw()

	Add(Widget)

	IsActive() bool
	SetActive(bool)

	IsModal() bool
	IsMovable() bool
}

type HBox

type HBox struct {
	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill

	Widgets []Widget
	// contains filtered or unexported fields
}

func NewHBox

func NewHBox(align Align, fill Fill, widgets ...Widget) *HBox

func (*HBox) Add

func (self *HBox) Add(widget Widget)

func (*HBox) Clear

func (self *HBox) Clear()

func (*HBox) Draw

func (self *HBox) Draw()

func (*HBox) GetAlign

func (self *HBox) GetAlign() Align

func (*HBox) GetBounds

func (self *HBox) GetBounds() rl.Rectangle

func (*HBox) GetDataSize

func (self *HBox) GetDataSize() Size

func (*HBox) GetFill

func (self *HBox) GetFill() Fill

func (*HBox) GetId

func (self *HBox) GetId() int32

func (*HBox) GetParent

func (self *HBox) GetParent() Widget

func (*HBox) GetWidgets

func (self *HBox) GetWidgets() []Widget

func (*HBox) SetBounds

func (self *HBox) SetBounds(bounds rl.Rectangle)

func (*HBox) SetId

func (self *HBox) SetId(id int32)

func (*HBox) SetParent

func (self *HBox) SetParent(parent Widget)

func (*HBox) Update

func (self *HBox) Update(dt float32)

type Image

type Image struct {
	Parent Widget
	Bounds rl.Rectangle

	Align Align
	Fill  Fill
	// contains filtered or unexported fields
}

func NewImage

func NewImage(align Align, fill Fill, texture rl.Texture2D, rectangle *rl.Rectangle) *Image

func (*Image) Draw

func (self *Image) Draw()

func (*Image) GetAlign

func (self *Image) GetAlign() Align

func (*Image) GetBounds

func (self *Image) GetBounds() rl.Rectangle

func (*Image) GetDataSize

func (self *Image) GetDataSize() Size

func (*Image) GetFill

func (self *Image) GetFill() Fill

func (*Image) GetId

func (self *Image) GetId() int32

func (*Image) GetParent

func (self *Image) GetParent() Widget

func (*Image) SetBounds

func (self *Image) SetBounds(bounds rl.Rectangle)

func (*Image) SetId

func (self *Image) SetId(id int32)

func (*Image) SetParent

func (self *Image) SetParent(parent Widget)

func (*Image) Update

func (self *Image) Update(dt float32)

type Label

type Label struct {
	Text string

	BorderColor     rl.Color
	BackgroundColor rl.Color
	TextColor       rl.Color

	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(align Align, fill Fill, text string) *Label

func (*Label) Draw

func (self *Label) Draw()

func (*Label) GetAlign

func (self *Label) GetAlign() Align

func (*Label) GetBounds

func (self *Label) GetBounds() rl.Rectangle

func (*Label) GetDataSize

func (self *Label) GetDataSize() Size

func (*Label) GetFill

func (self *Label) GetFill() Fill

func (*Label) GetId

func (self *Label) GetId() int32

func (*Label) GetParent

func (self *Label) GetParent() Widget

func (*Label) SetBounds

func (self *Label) SetBounds(bounds rl.Rectangle)

func (*Label) SetId

func (self *Label) SetId(id int32)

func (*Label) SetParent

func (self *Label) SetParent(parent Widget)

func (*Label) Update

func (self *Label) Update(dt float32)

type Layout

type Layout interface {
	Widget

	Add(Widget)
	GetWidgets() []Widget
	Clear()
}

type LazyLoader

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

func NewLazyLoader

func NewLazyLoader() *LazyLoader

func (*LazyLoader) Load

func (self *LazyLoader) Load(name string) rl.Texture2D

func (*LazyLoader) Unload

func (self *LazyLoader) Unload(name string)

func (*LazyLoader) UnloadAll

func (self *LazyLoader) UnloadAll()

type ListView

type ListView struct {
	OnClick       func(string)
	OnDoubleClick func(string)
	// contains filtered or unexported fields
}

func NewListView

func NewListView(items []string, visibles int) *ListView

func (*ListView) Draw

func (self *ListView) Draw()

func (*ListView) GetAlign

func (self *ListView) GetAlign() Align

func (*ListView) GetBounds

func (self *ListView) GetBounds() rl.Rectangle

func (*ListView) GetCount

func (self *ListView) GetCount() int

func (*ListView) GetCurrent

func (self *ListView) GetCurrent() int

func (*ListView) GetCurrentItem

func (self *ListView) GetCurrentItem() string

func (*ListView) GetDataSize

func (self *ListView) GetDataSize() Size

func (*ListView) GetFill

func (self *ListView) GetFill() Fill

func (*ListView) GetId

func (self *ListView) GetId() int32

func (*ListView) GetParent

func (self *ListView) GetParent() Widget

func (*ListView) RemoveScrollbar

func (self *ListView) RemoveScrollbar()

func (*ListView) Scroll

func (self *ListView) Scroll(times int)

func (*ListView) SetBounds

func (self *ListView) SetBounds(bounds rl.Rectangle)

func (*ListView) SetCurrent

func (self *ListView) SetCurrent(index int)

func (*ListView) SetId

func (self *ListView) SetId(id int32)

func (*ListView) SetItems

func (self *ListView) SetItems(items []string)

func (*ListView) SetParent

func (self *ListView) SetParent(parent Widget)

func (*ListView) Update

func (self *ListView) Update(dt float32)

type Notification

type Notification struct {
	Text     string
	Point    rl.Vector2
	FontSize int32
	Color    rl.Color
	Duration time.Duration
}

func (*Notification) Draw

func (self *Notification) Draw()

type Scrollable

type Scrollable interface {
	Widget

	Scroll(int)

	GetCount() int

	GetCurrent() int
	SetCurrent(int)
}

type Scrollbar

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

func NewScrollbar

func NewScrollbar(fill Fill, scrollable Scrollable) *Scrollbar

func (*Scrollbar) Draw

func (self *Scrollbar) Draw()

func (*Scrollbar) GetAlign

func (self *Scrollbar) GetAlign() Align

func (*Scrollbar) GetBounds

func (self *Scrollbar) GetBounds() rl.Rectangle

func (*Scrollbar) GetDataSize

func (self *Scrollbar) GetDataSize() Size

func (*Scrollbar) GetFill

func (self *Scrollbar) GetFill() Fill

func (*Scrollbar) GetId

func (self *Scrollbar) GetId() int32

func (*Scrollbar) GetParent

func (self *Scrollbar) GetParent() Widget

func (*Scrollbar) SetBounds

func (self *Scrollbar) SetBounds(bounds rl.Rectangle)

func (*Scrollbar) SetId

func (self *Scrollbar) SetId(id int32)

func (*Scrollbar) SetParent

func (self *Scrollbar) SetParent(parent Widget)

func (*Scrollbar) Update

func (self *Scrollbar) Update(dt float32)

type Size

type Size struct {
	Width  float32
	Height float32
}

type State

type State int32
const (
	Normal State = iota
	Focused
	Pressed
	Released
	Disabled
)

func GetState

func GetState(bounds rl.Rectangle) State

type Style

type Style struct {
	GlobalBaseColor                 rl.Color
	GlobalBorderColor               rl.Color
	GlobalTextColor                 rl.Color
	GlobalTextFontsize              int
	GlobalBorderHeight              int
	GlobalBackgroundColor           rl.Color
	GlobalLinesColor                rl.Color
	GlobalPadding                   int
	DialogTitleFontsize             int
	DialogTitleBackgroundColor      rl.Color
	DialogTitleTextColor            rl.Color
	LabelBorderWidth                int
	LabelTextColor                  rl.Color
	LabelTextPadding                int
	ButtonBorderWidth               int
	ButtonTextPadding               int
	ButtonDefaultBorderColor        rl.Color
	ButtonDefaultInsideColor        rl.Color
	ButtonDefaultTextColor          rl.Color
	ButtonHoverBorderColor          rl.Color
	ButtonHoverInsideColor          rl.Color
	ButtonHoverTextColor            rl.Color
	ButtonPressedBorderColor        rl.Color
	ButtonPressedInsideColor        rl.Color
	ButtonPressedTextColor          rl.Color
	ComboboxPadding                 int
	ComboboxWidth                   int
	ComboboxHeight                  int
	ComboboxBorderWidth             int
	ComboboxDefaultBorderColor      rl.Color
	ComboboxDefaultInsideColor      rl.Color
	ComboboxDefaultTextColor        rl.Color
	ComboboxDefaultListTextColor    rl.Color
	ComboboxHoverBorderColor        rl.Color
	ComboboxHoverInsideColor        rl.Color
	ComboboxHoverTextColor          rl.Color
	ComboboxHoverListTextColor      rl.Color
	ComboboxPressedBorderColor      rl.Color
	ComboboxPressedInsideColor      rl.Color
	ComboboxPressedTextColor        rl.Color
	ComboboxPressedListBorderColor  rl.Color
	ComboboxPressedListInsideColor  rl.Color
	ComboboxPressedListTextColor    rl.Color
	CheckboxDefaultBorderColor      rl.Color
	CheckboxDefaultInsideColor      rl.Color
	CheckboxHoverBorderColor        rl.Color
	CheckboxHoverInsideColor        rl.Color
	CheckboxClickBorderColor        rl.Color
	CheckboxClickInsideColor        rl.Color
	CheckboxDefaultActiveColor      rl.Color
	CheckboxInsideWidth             int
	TextboxBorderWidth              int
	TextboxBorderColor              rl.Color
	TextboxActiveBorderColor        rl.Color
	TextboxInsideColor              rl.Color
	TextboxTextColor                rl.Color
	TextboxLineColor                rl.Color
	TextboxTextFontsize             int
	ListviewTextColor               rl.Color
	ListviewSelectedTextColor       rl.Color
	ListviewSelectedBackgroundColor rl.Color
}

func GetStyle

func GetStyle() *Style

func NewStyle

func NewStyle() *Style

func (*Style) Load

func (self *Style) Load(filename string)

func (*Style) Save

func (self *Style) Save(filename string)

func (*Style) Scale

func (self *Style) Scale(scale float32)

type Textbox

type Textbox struct {
	Text string

	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill
	// contains filtered or unexported fields
}

func NewTextbox

func NewTextbox(align Align, fill Fill, runeCount int) *Textbox

func (*Textbox) Draw

func (self *Textbox) Draw()

func (*Textbox) GetAlign

func (self *Textbox) GetAlign() Align

func (*Textbox) GetBounds

func (self *Textbox) GetBounds() rl.Rectangle

func (*Textbox) GetDataSize

func (self *Textbox) GetDataSize() Size

func (*Textbox) GetFill

func (self *Textbox) GetFill() Fill

func (*Textbox) GetId

func (self *Textbox) GetId() int32

func (*Textbox) GetParent

func (self *Textbox) GetParent() Widget

func (*Textbox) SetBounds

func (self *Textbox) SetBounds(bounds rl.Rectangle)

func (*Textbox) SetId

func (self *Textbox) SetId(id int32)

func (*Textbox) SetParent

func (self *Textbox) SetParent(parent Widget)

func (*Textbox) Update

func (self *Textbox) Update(dt float32)

type VBox

type VBox struct {
	Parent Widget

	Bounds rl.Rectangle
	Align  Align
	Fill   Fill

	Widgets []Widget
	// contains filtered or unexported fields
}

func NewVBox

func NewVBox(align Align, fill Fill, widgets ...Widget) *VBox

func (*VBox) Add

func (self *VBox) Add(widget Widget)

func (*VBox) Clear

func (self *VBox) Clear()

func (*VBox) Draw

func (self *VBox) Draw()

func (*VBox) GetAlign

func (self *VBox) GetAlign() Align

func (*VBox) GetBounds

func (self *VBox) GetBounds() rl.Rectangle

func (*VBox) GetDataSize

func (self *VBox) GetDataSize() Size

func (*VBox) GetFill

func (self *VBox) GetFill() Fill

func (*VBox) GetId

func (self *VBox) GetId() int32

func (*VBox) GetParent

func (self *VBox) GetParent() Widget

func (*VBox) GetWidgets

func (self *VBox) GetWidgets() []Widget

func (*VBox) SetBounds

func (self *VBox) SetBounds(bounds rl.Rectangle)

func (*VBox) SetId

func (self *VBox) SetId(id int32)

func (*VBox) SetParent

func (self *VBox) SetParent(parent Widget)

func (*VBox) Update

func (self *VBox) Update(dt float32)

type Widget

type Widget interface {
	GetId() int32
	SetId(int32)

	GetParent() Widget
	SetParent(Widget)

	GetBounds() rl.Rectangle
	SetBounds(rl.Rectangle)
	GetDataSize() Size

	GetAlign() Align
	GetFill() Fill

	Update(float32)
	Draw()
}

type Window

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

func NewWindow

func NewWindow(bounds rl.Rectangle, widgets ...Widget) *Window

func (*Window) Add

func (self *Window) Add(widget Widget)

func (*Window) Draw

func (self *Window) Draw()

func (*Window) GetBounds

func (self *Window) GetBounds() rl.Rectangle

func (*Window) IsActive

func (self *Window) IsActive() bool

func (*Window) IsModal

func (self *Window) IsModal() bool

func (*Window) IsMovable

func (self *Window) IsMovable() bool

func (*Window) SetActive

func (self *Window) SetActive(value bool)

func (*Window) SetBounds

func (self *Window) SetBounds(bounds rl.Rectangle)

func (*Window) Update

func (self *Window) Update(dt float32)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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