screenbind

package
v0.4.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package screenbind generates deterministic, typed Go bindings from *.screen.yaml files.

Index

Constants

View Source
const (
	// Header is the first line of every Go file generated by game generate screen.
	Header = "// Code generated by game generate screen; DO NOT EDIT."
	// SourcePrefix prefixes the second line of a generated screen file with its slash-separated project-relative screen path.
	SourcePrefix = "// Source: "
)

Variables

This section is empty.

Functions

func Generate

func Generate(doc *gameui.ScreenDoc, opts Options) ([]byte, error)

Generate renders deterministic, gofmt-formatted Go bindings for doc.

func HasHeader

func HasHeader(data []byte) bool

HasHeader reports whether data begins with the generated screen bindings header.

func NormalizeSource

func NormalizeSource(source string) (string, error)

NormalizeSource cleans a slash-separated screen path and verifies it has a .screen.yaml or .screen.yml suffix.

func OutputFileName

func OutputFileName(source string) (string, error)

OutputFileName returns the Go file name written for source (for example "hud_screen_gen.go").

func ParseHeader

func ParseHeader(data []byte) (source string, ok bool)

ParseHeader reports whether data begins with Header followed by a non-empty SourcePrefix line, returning the source path.

func ScreenIdent

func ScreenIdent(source string) (goName, snake string, err error)

ScreenIdent derives the exported Go type prefix (for example "HUD") and snake_case file stem ("hud") from a *.screen.yaml or *.screen.yml path.

func TopLevelDecls

func TopLevelDecls(source string) ([]string, error)

TopLevelDecls returns the package-level Go identifiers generated for source.

Types

type Options

type Options struct {
	// Package is the Go package name of the generated file.
	Package string
	// Source is the slash-separated project-relative path to the screen file (for example "screens/hud.screen.yaml").
	Source string
}

Options configures Generate.

Jump to

Keyboard shortcuts

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