editor

package
v0.0.0-...-04212e3 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DisposeContext

func DisposeContext(context *TypeEditContext, key reflect.Value)

func GetContext

func GetContext[T any](context *TypeEditContext, key reflect.Value) (*T, bool)

GetContext returns a *T from the TypeEditContext. Custom editors should use this function to save off context during edits returns true if this is the first time the context has been created

func StructEd

func StructEd(context *TypeEditContext, value reflect.Value) error

func WriteFS

func WriteFS(base string) asset.WriteableFileSystem

Types

type Disposable

type Disposable interface {
	Dispose(context *TypeEditContext)
}

if a type stored by using GetContext implements Disposable then Dispose will be called when the asset editor window is closed

type Drawable

type Drawable interface {
	// Draw allows an item to render itself.
	// if the returned error is not nil the drawable
	// will be removed from the draw list
	Draw() error
}

type EbitengineWrapper

type EbitengineWrapper struct {
	ImguiManager *renderer.Manager
	Editor       *ImguiEditor
	// contains filtered or unexported fields
}

func NewEbitengineWrapper

func NewEbitengineWrapper(w, h int) *EbitengineWrapper

func (*EbitengineWrapper) Draw

func (g *EbitengineWrapper) Draw(screen *ebiten.Image)

func (*EbitengineWrapper) Layout

func (g *EbitengineWrapper) Layout(outsideWidth, outsideHeight int) (int, int)

func (*EbitengineWrapper) Update

func (g *EbitengineWrapper) Update() error

type ImguiEditor

type ImguiEditor struct {
	// Link to the ebiten-imgui/renderer.Manager instance that is running the editor
	Manager *renderer.Manager
	// contains filtered or unexported fields
}

func New

func New(path string, manager *renderer.Manager) *ImguiEditor

func (*ImguiEditor) AddDrawable

func (e *ImguiEditor) AddDrawable(d Drawable)

func (*ImguiEditor) AddMenu

func (ed *ImguiEditor) AddMenu(menu edgui.Menu)

func (*ImguiEditor) AddType

func (e *ImguiEditor) AddType(typeToAdd any, edit TypeEditorFn)

func (*ImguiEditor) DisposeImguiTexture

func (e *ImguiEditor) DisposeImguiTexture(key any)

func (*ImguiEditor) EditAsset

func (e *ImguiEditor) EditAsset(path string)

func (*ImguiEditor) GetImguiTexture

func (e *ImguiEditor) GetImguiTexture(key any, width int, height int) (id imgui.TextureID, img *ebiten.Image)

GetImguiTexture creates a new ebiten.Image of size width, height and registers the image into the imgui texture system. The return values are the id that can be used with imgui.Image() and the img can be used with ebiten code. When called repeatedly with the same key, no real work will be done, and cached values are returned. If the size changes then the old texture is disposed

func (*ImguiEditor) RegisterEnum

func (ed *ImguiEditor) RegisterEnum(mapping map[any]string)

func (*ImguiEditor) StartGameCallback

func (e *ImguiEditor) StartGameCallback(startGame func() ebiten.Game)

func (*ImguiEditor) Update

func (e *ImguiEditor) Update(deltaseconds float32) error

type TypeEditContext

type TypeEditContext struct {
	Ed *ImguiEditor
	// contains filtered or unexported fields
}

func NewTypeEditContext

func NewTypeEditContext(ed *ImguiEditor, assetPath string, target asset.Asset) *TypeEditContext

func (*TypeEditContext) Edit

func (c *TypeEditContext) Edit(obj any)

Edit calls EditValue. Custom type editors can use this to edit fields.

func (*TypeEditContext) EditValue

func (c *TypeEditContext) EditValue(value reflect.Value)

EditValue allows the custom type editors to edit sub parts of themselves without needing to re-implement the editors

func (*TypeEditContext) FieldPathStackName

func (c *TypeEditContext) FieldPathStackName() string

func (*TypeEditContext) GetContext

func (c *TypeEditContext) GetContext(key reflect.Value)

GetContext exists just to help you find editor.GetContext[T](*TypeEditContext, reflect.Value)

func (*TypeEditContext) ID

func (c *TypeEditContext) ID(prefix string) string

func (*TypeEditContext) PopStructField

func (c *TypeEditContext) PopStructField()

func (*TypeEditContext) PushStructField

func (c *TypeEditContext) PushStructField(sf *reflect.StructField)

func (*TypeEditContext) SetChanged

func (c *TypeEditContext) SetChanged()

func (*TypeEditContext) StructField

func (c *TypeEditContext) StructField() *reflect.StructField

type TypeEditorFn

type TypeEditorFn func(*TypeEditContext, reflect.Value) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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