Nimble Tools utilities for the Foster game framework.
Find a file
2025-11-30 17:04:25 +01:00
Foster@e6d0fe7671 Updated Foster and Nimble.Layout 2025-11-30 17:04:25 +01:00
Nimble.Foster Updated Foster and Nimble.Layout 2025-11-30 17:04:25 +01:00
Nimble.Foster.GUI Updated Foster and Nimble.Layout 2025-11-30 17:04:25 +01:00
Nimble.Foster.LDtk Updated Foster and Nimble.Layout 2025-11-30 17:04:25 +01:00
Nimble.Layout@6e1d76f38b Updated Foster and Nimble.Layout 2025-11-30 17:04:25 +01:00
.gitignore Initial commit 2025-02-22 11:18:30 +01:00
.gitmodules Remove Nimble.React (fixes #1) 2025-08-22 14:50:20 +02:00
License.txt Added license 2025-02-22 11:46:31 +01:00
Nimble.Foster.sln Removed Boil for now (fixes #2) 2025-08-22 15:52:05 +02:00
Readme.md Updated Readme 2025-09-06 19:38:11 +02:00

Nimble.Foster

Libraries for the Foster game framework.

Installation

Nimble.Foster not on NuGet yet, but I plan to put it there soon. For now, you'll have to add the necessary projects as manual references in your project. This can be done using Git Submodules, for example.

GUI

The GUI library is going to get updated quite a bit over time. There's a lack of documentation right now, but here's an example GUI.xml:

<GUI>
	<Template>
		<Box Width="500" P9="Frame.png">
			<Vbox Behave="Fill" Margin="10" Spacing="10">
				<Text>Nimble.Foster.GUI</Text>
				<Text Behave="Center">Nimble.Foster.GUI</Text>
				<Text Behave="Right">Nimble.Foster.GUI</Text>
				<Hbox Spacing="10">
					<Button ID="Button">Click me!!</Button>
					<Button>Button 2</Button>
					<Button>Third</Button>
				</Hbox>
			</Vbox>
		</Box>
	</Template>
</GUI>

And the necessary C# to render it in your Foster app:

internal partial class Game : App
{
	public Game() : base("Idler", 1600, 900)
	{
		Batcher = new(GraphicsDevice);

		GUILoader = new(GraphicsDevice);
		GUILoader.AddFont("Xerxes", "Xerxes 10.ttf");

		GUI = GUILoader.HostFromFile("GUI.xml");
		GUI.Transform = Matrix3x2.CreateScale(2);

		if (GUI.Root!.FindChildByID<ButtonWidget>("Button", out var button)) {
			button.FocusConfirmed += (o, e) => {
				Console.WriteLine("Button pressed");
			};
		}
	}

	protected override void Update()
	{
		GUI.Update(Input);
	}

	protected override void Render()
	{
		Window.Clear(Color.CornflowerBlue);

		GUI.Render(Batcher);

		Batcher.Render(Window);
		Batcher.Clear();
	}
}