Skip to content

MonoGame and .NET

OpenBone.Runtime is the C# runtime for .NET Standard 2.1. OpenBone.MonoGame adds a renderer, a player with pointer input and a SoundEffect bridge for MonoGame 3.8, and OpenBone.Scripting.Jint runs document scripts.

Terminal window
dotnet add package OpenBone.Runtime
dotnet add package OpenBone.MonoGame
dotnet add package OpenBone.Scripting.Jint

Put the exported .obone or .obonb file and its images in your Content/ folder, copied to the output directory.

The Export dialog with JSON selected for the Knight
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using OpenBone.MonoGame;
public class Game1 : Game
{
readonly GraphicsDeviceManager graphics;
OpenBoneMonoGame knight;
public Game1()
{
// Clipping masks use the stencil buffer.
graphics = new GraphicsDeviceManager(this) { PreferredDepthStencilFormat = DepthFormat.Depth24Stencil8 };
IsMouseVisible = true;
}
protected override void LoadContent()
{
knight = OpenBoneMonoGame.Load(GraphicsDevice, "Content/knight.obone");
knight.UseStateMachine("knight"); // or: knight.Play("walk");
knight.Event += e => System.Console.WriteLine($"event {e.Name}");
}
protected override void Update(GameTime gameTime)
{
knight.Update(gameTime); // pointer input, advance, sound
base.Update(gameTime);
}
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
knight.Draw();
base.Draw(gameTime);
}
}

Reference: OpenBone.MonoGame · C# runtime · OpenBone.Scripting.Jint

OpenBone is MIT licensed and made by UXCentury. The example art, voices and sounds are credited in the repository.