Skip to content

shitake2333/GUML

Repository files navigation

Godot UI Markup Language

NuGet GitHub Release License

GUML is a declarative UI markup language (.guml) for Godot .NET, providing a QML/XAML-like development experience. It allows developers to define UI components and layouts using a concise syntax, with support for data binding, event handling, and reusable components. GUML uses Roslyn Source Generator for compile-time code generation, delivering maximum performance with zero runtime overhead.

Features

  • QML-like declarative syntax
  • Data binding — automatically update UI when controller properties change (one-way :=, two-way <=>, reverse =:)
  • Event wiring — connect Godot signals and C# events with one line
  • List rendering — each blocks with incremental updates via ObservableCollection<T>
  • Reusable components — compose and reuse .guml files with typed parameters
  • Full Godot UI component support (all built-in Control types)
  • Theme overrides — set theme styles directly in GUML
  • Source Generator mode — compile-time code generation for maximum performance

Install

dotnet add package GUML

For source generator support:

dotnet add package GUML.SourceGenerator

Documentation

Language Specification

The formal GUML language specification is available in the GUMLSpec directory. It covers:

  • Lexical structure & grammar (BNF)
  • Types, expressions, and directives
  • Component model and controller integration
  • Code generation and API interface specifications
  • Diagnostics

IDE Support

Editor plugins have been moved to their own repositories:

Editor Repository
VS Code GUML.VSC
JetBrains Rider GUML.Rider

Project Structure

Directory Description
GUML Core runtime library — GuiController, converters, bindings
GUML.Shared Shared infrastructure — full-fidelity CST parser, API metadata models, diagnostics
GUML.SourceGenerator Roslyn source generator for compile-time .guml → C# code generation
GUML.Analyzer Language analyzer CLI tool — Roslyn-based project analysis and LSP features via JSON-RPC
GUMLSpec Formal language specification
Doc User documentation (guides, reference, quick start)
TestApplication Sample Godot project demonstrating GUML usage

Example

main.guml:

Panel {
    size: vec2(640, 480),
    theme_overrides: { 
        panel: style_box_flat({
            bg_color: color(0.4, 0.4, 0.4, 0.4)
        })
    },
    Label {
        position: vec2(10, 10),
        size: vec2(200, 30),
        // $controller.SayHello binding to Label.text.If SayHello changes, text will also change.
        text:= "hello " + $controller.SayHello
    }
    
    Button {
        position: vec2(10, 50),
        size: vec2(200, 30),
        text: "Change world",
        #pressed: $controller.ChangeHelloBtnPressed
    }
}

MainController.cs:

public class MainController : GuiController
{
    public string SayHello {
	    get => _sayHello;
		set
		{
			_sayHello = value;
			OnPropertyChanged();
		}
    }
	
    private string _sayHello = "world!";

	public void ChangeHelloBtnPressed()
	{
		SayHello = "new world!";
	}
}

example

After clicking the change world button, the text will change to hello new world!

License

MIT

About

Godot UI Markup Language

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages