imgui_wrapper

package
v0.7.39 Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2026 License: BSD-3-Clause, BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Overview

Package imgui_wrapper provides a basic framework for an IMGui app.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddFont added in v0.7.37

func AddFont(id string, spec FontSpec) (overwrote bool)

func FontDefault added in v0.7.15

func FontDefault() *imgui.Font

Current fonts.

func FontMono added in v0.7.0

func FontMono() *imgui.Font

func GetFont added in v0.7.37

func GetFont(id string) (font *imgui.Font, ok bool)

func Main

func Main(title string, options Options) error

func RemoveFont added in v0.7.37

func RemoveFont(id string) (removed bool)

Types

type FontSpec added in v0.7.37

type FontSpec struct {
	Scale        float32 // 1 is 100%; as an exception, 0 is treated like 1
	Order        int     // lower is loaded earlier in merge component
	TtfData      []byte
	ExtraConfig  func(fc *imgui.FontConfig, fontSize float32)
	MergeWithIds []string
}

type Options

type Options struct {
	// Initial window size.
	WindowSize imgui.Vec2
	// Minimum window size, or zero.
	WindowMinSize imgui.Vec2
	// Called once, after the initial
	// state is determined and before any
	// drawing takes place. May be nil.
	OnInitWindow func(state *State) error
	// Called to do various pre-frame setup.
	// If anything can err, it should happen
	// in here. No drawing should take place
	// in here. May be nil.
	OnPreDraw func(state *State) error
	// Should not return an error. Control
	// flow should be straight-forward and
	// always reach the end.
	OnDraw func(state *State)
	// Drag-and-drop drop callback, or nil.
	OnDrop func(paths []string)
	// Window icons
	Icons []image.Image
	// Make the OpenGL context a debug context.
	GLDebugContext bool
}

type State

type State struct {
	// Target FPS, can be changed anytime seamlessly.
	FrameRate float64
	// GUI Scale and CJK fonts will need a bit of
	// time to load after changing to a different
	// value.
	GUIScale              float32
	LoadCJKFonts          bool
	DarkWindowDecorations bool
	// WindowShouldClose app on next frame.
	WindowShouldClose bool
	// contains filtered or unexported fields
}

State contains exported fields, which can be changed anytime by the callback functions to update certain settings.

Jump to

Keyboard shortcuts

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