microui

package module
v0.0.0-...-376dbfe Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

README

Microui for Ebitengine

The project is currently under development. The API is subject to frequent changes. Please do not use it in production.

A Microui fork for Ebitengine. The original Microui was developed by @rxi. The original Go port was developed by @zeozeozeo and @Zyko0.

License

Microui for Ebitengine is licensed under Apache license version 2.0. See LICENSE file.

Microui

https://github.com/rxi/microui

Copyright (c) 2024 rxi

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

Documentation

Index

Constants

View Source
const (
	ColorText = iota
	ColorBorder
	ColorWindowBG
	ColorTitleBG
	ColorTitleText
	ColorPanelBG
	ColorButton
	ColorButtonHover
	ColorButtonFocus
	ColorBase
	ColorBaseHover
	ColorBaseFocus
	ColorScrollBase
	ColorScrollThumb
	ColorMax = ColorScrollThumb
)

Variables

This section is empty.

Functions

func DrawText

func DrawText(dst *ebiten.Image, str string, op *text.DrawOptions)

Types

type Container

type Container struct {
	HeadIdx     int
	TailIdx     int
	Rect        image.Rectangle
	Body        image.Rectangle
	ContentSize image.Point
	Scroll      image.Point
	ZIndex      int
	Open        bool
}

type Context

type Context struct {
	Style *Style

	LastID ID
	// contains filtered or unexported fields
}

func NewContext

func NewContext() *Context

func (*Context) Button

func (c *Context) Button(label string) Response

func (*Context) Checkbox

func (c *Context) Checkbox(label string, state *bool) Response

func (*Context) Container

func (c *Context) Container(name string) *Container

func (*Context) Control

func (c *Context) Control(id ID, opt Option, f func(r image.Rectangle) Response) Response

func (*Context) CurrentContainer

func (c *Context) CurrentContainer() *Container

func (*Context) Draw

func (c *Context) Draw(screen *ebiten.Image)

func (*Context) DrawControl

func (c *Context) DrawControl(f func(screen *ebiten.Image))

func (*Context) Header

func (c *Context) Header(label string) Response

func (*Context) HeaderEx

func (c *Context) HeaderEx(label string, opt Option) Response

func (*Context) Label

func (c *Context) Label(text string)

func (*Context) LayoutColumn

func (c *Context) LayoutColumn(f func())

func (*Context) Number

func (c *Context) Number(value *float64, step float64) Response

func (*Context) NumberEx

func (c *Context) NumberEx(value *float64, step float64, format string, opt Option) Response

func (*Context) OpenPopup

func (c *Context) OpenPopup(name string)

func (*Context) Panel

func (c *Context) Panel(name string, f func())

func (*Context) Popup

func (c *Context) Popup(name string, f func(res Response))

func (*Context) SetFocus

func (c *Context) SetFocus(id ID)

func (*Context) SetLayoutRow

func (c *Context) SetLayoutRow(widths []int, height int)

func (*Context) Slider

func (c *Context) Slider(value *float64, lo, hi float64) Response

func (*Context) SliderEx

func (c *Context) SliderEx(value *float64, low, high, step float64, format string, opt Option) Response

func (*Context) Text

func (c *Context) Text(text string)

func (*Context) TextBox

func (c *Context) TextBox(buf *string) Response

func (*Context) TreeNode

func (c *Context) TreeNode(label string, f func(res Response))

func (*Context) Update

func (c *Context) Update(f func())

func (*Context) Window

func (c *Context) Window(title string, rect image.Rectangle, f func(res Response))

type ID

type ID uint64

type Option

type Option int
const (
	OptAlignCenter Option = (1 << iota)
	OptAlignRight
	OptNoInteract
	OptNoFrame
	OptNoResize
	OptNoScroll
	OptNoClose
	OptNoTitle
	OptHoldFocus
	OptAutoSize
	OptPopup
	OptClosed
	OptExpanded
)

type Response

type Response int
const (
	ResponseActive Response = (1 << 0)
	ResponseSubmit Response = (1 << 1)
	ResponseChange Response = (1 << 2)
)

type Style

type Style struct {
	Size          image.Point
	Padding       int
	Spacing       int
	Indent        int
	TitleHeight   int
	ScrollbarSize int
	ThumbSize     int
	Colors        [ColorMax + 1]color.RGBA
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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