LDtkMonogame is an level importer for the LDtk level editor.
- UWP library : Min Win. SDK is 16299, Main Win. SDK is 19041. So, no W10M compatibility yet.
- This is veeery quick (fast) and dirty "UWP-Remake" of LDtkMonogame project.
- To be continued (I hope)
The easiest way to start using LDtkMonogame is to import it into the project using NuGet package.
Make sure to import the namespace at the top
using LDtk;
// Optional
using LDtk.Renderer;LDtk.Renderer is a premade renderer for the levels, you can create your own if you have more specific needs ExampleRenderer.cs is an example of how to make one. Or you can inherit it and extend it.
To get started loading ldtk files load the file in Initialize.
LDtkFile file = LDtkFile.FromFile("World", Content);
LDtkFile file = LDtkFile.FromFile("Data/World.ldtk");Then load the world right after for now ldtk only supports one file but make sure to enable the multiworlds flag in the project settings under advanced.
LDtkWorld world = file.LoadWorld(Worlds.World.Iid);The Worlds.World.Iid is generated from the ldtkgen tool and is recommended that you use it for static typing of entities and levels.
It is a class within in a class that represents the world name and the levels name and holds the iid you can use to load that specific level.
Create the renderer in Initialize.
ExampleRenderer renderer = new ExampleRenderer(spriteBatch, Content);
ExampleRenderer renderer = new ExampleRenderer(spriteBatch);Prerender Levels
foreach (LDtkLevel level in world.Levels)
{
renderer.PrerenderLevel(level);
}Now to render the level and entities we loaded in Draw
GraphicsDevice.Clear(world.BgColor);
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
{
foreach (LDtkLevel level in world.Levels)
{
renderer.RenderPrerenderedLevel(level);
}
}
spriteBatch.End();by Fypur
As is. No support. DIY. Learn purposes only.
https://github.com/IrishBruse/LDtkMonogame Original LDtkMonogame (by Ethan Conneely aka IrishBruse)
[m][e] March 2025


