pixelui

package module
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2024 License: MIT Imports: 13 Imported by: 1

README

PixelUI

Adds GUIs to the Pixel rendering engine by interpreting imgui-go render data into Pixel render calls.

Example

The examples repository contains an example demonstrating PixelUI's functionality.

To run an example, navigate to it's directory, then go run the test.go file. For example:

$ cd example
$ go run test.go

Current Expected state

This is where we are currently... Current State

Documentation

Index

Constants

View Source
const (
	NO_DEFAULT_FONT uint8 = 1 << iota
)

pixelui.NewUI flags:

NO_DEFAULT_FONT: Do not load the default font during New.

Variables

This section is empty.

Functions

func Color

func Color(r, g, b uint8) imgui.Vec4

Color converts the given 8-bit r,g,b components to a imgui.Vec4 for color arguments

func ColorA

func ColorA(r, g, b, a uint8) imgui.Vec4

Color converts the given 8-bit r,g,b,a components to a imgui.Vec4 for color arguments

func IV

func IV(x, y float64) imgui.Vec2

IV creates an imgui vector from the given points.

func IVec

func IVec(v pixel.Vec) imgui.Vec2

IVec converts a pixel vector to an imgui vector

func IZV

func IZV() imgui.Vec2

IZV returns an imgui zero vector

func PV

func PV(v imgui.Vec2) pixel.Vec

PV converts an imgui vector to a pixel vector

func ProjectV

func ProjectV(x, y float64) imgui.Vec2

ProjectV creates a pixel vector and projects it using ProjectVec

func ProjectVec

func ProjectVec(v pixel.Vec) imgui.Vec2

ProjectVec projects the vector by the UI's matrix (vertical flip)

and returns that as a imgui vector

func UnprojectV

func UnprojectV(v imgui.Vec2) pixel.Vec

UnprojectV unprojects the vector by the UI's matrix (vertical flip)

and returns that as a pixel vector

Types

type Clipboard

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

func (Clipboard) SetText

func (c Clipboard) SetText(value string)

func (Clipboard) Text

func (c Clipboard) Text() (text string, err error)

type UI

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

UI Stores the state of the pixelui UI

var CurrentUI *UI

func New

func New(win *opengl.Window, atlas *atlas.Atlas, flags uint8) *UI

New Creates the UI and setups up its internal structures

func (*UI) AddTTFFont

func (ui *UI) AddTTFFont(path string, size float32)

AddTTFFont loads the given font into imgui.

func (*UI) Draw

func (ui *UI) Draw(win *opengl.Window)

Draw Draws the imgui UI to the Pixel Window

func (*UI) JustPressed

func (ui *UI) JustPressed(button pixel.Button) bool

JustPressed returns true if imgui hasn't handled the button and the button was just pressed

func (*UI) JustReleased

func (ui *UI) JustReleased(button pixel.Button) bool

JustPressed returns true if imgui hasn't handled the button and the button was just released

func (*UI) KeyAlt

func (ui *UI) KeyAlt() bool

KeyCtrl returns true if either left or right alt is pressed

func (*UI) KeyCtrl

func (ui *UI) KeyCtrl() bool

KeyCtrl returns true if either left or right control is pressed

func (*UI) KeyShift

func (ui *UI) KeyShift() bool

KeyCtrl returns true if either left or right shift is pressed

func (*UI) KeySuper

func (ui *UI) KeySuper() bool

KeyCtrl returns true if either left or right super (windows key) is pressed

func (*UI) MouseScroll

func (ui *UI) MouseScroll() pixel.Vec

MouseScroll returns the mouse scroll amount if imgui does not want the mouse

(if mouse is not hovering an imgui element)

func (*UI) NewFrame

func (ui *UI) NewFrame()

NewFrame Call this at the beginning of the frame to tell the UI that the frame has started

func (*UI) Pressed

func (ui *UI) Pressed(button pixel.Button) bool

JustPressed returns true if imgui hasn't handled the button and the button is pressed

func (*UI) Repeated

func (ui *UI) Repeated(button pixel.Button) bool

Repeated returns true if imgui hasn't handled the button and the button was repeated

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳