LDtkMonogame 1.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package LDtkMonogame --version 1.0.1                
NuGet\Install-Package LDtkMonogame -Version 1.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LDtkMonogame" Version="1.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LDtkMonogame --version 1.0.1                
#r "nuget: LDtkMonogame, 1.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LDtkMonogame as a Cake Addin
#addin nuget:?package=LDtkMonogame&version=1.0.1

// Install LDtkMonogame as a Cake Tool
#tool nuget:?package=LDtkMonogame&version=1.0.1                

<h1 align="center"> <a href="https://irishbruse.github.io/LDtkMonogame/">LDtkMonogame Wiki</a><br/> <a href="https://ldtk.io/go/discord"> <img alt="Discord" src="https://img.shields.io/discord/761549092677353513?color=%236370f4&label=Discord"> </a> </h1>

Monogame renderer and importer for LDtk Level editor

Getting Started

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 LDtkRenderer.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.

LDtkRenderer renderer = new LDtkRenderer(spriteBatch, Content);
LDtkRenderer renderer = new LDtkRenderer(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();
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on LDtkMonogame:

Package Downloads
LDtkMonogame.ContentPipeline

LDtk contentpipeline extension for importing .ldtk and .ldtkl files

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.6.0 162 10/14/2024
1.6.0-beta 92 10/9/2024
1.5.0 133 9/26/2024
1.5.0-beta 91 9/20/2024
1.4.0 150 9/9/2024
1.3.3 176 7/7/2024
1.3.2 250 5/28/2024
1.3.1 123 5/26/2024
1.3.0 133 5/24/2024
1.2.0 440 1/25/2024
1.1.2 718 9/8/2023
1.1.1 640 7/15/2023
1.1.0 621 6/8/2023
1.0.1 943 1/15/2023
1.0.0 843 1/3/2023
0.7.0 1,070 7/26/2022
0.6.5 1,087 7/20/2022
0.6.4 1,084 6/14/2022
0.6.3 1,099 6/14/2022
0.6.2 1,110 5/10/2022
0.6.1 1,146 5/10/2022
0.6.0 1,114 5/10/2022 0.6.0 is deprecated because it has critical bugs.
0.5.0 1,128 5/9/2022
0.4.0 994 12/23/2021
0.3.1 890 2/27/2021
0.3.0 828 2/22/2021
0.2.0 951 2/9/2021 0.2.0 is deprecated because it is no longer maintained.
0.1.1 986 2/1/2021 0.1.1 is deprecated because it is no longer maintained.
0.1.0 862 1/27/2021 0.1.0 is deprecated because it is no longer maintained.
0.0.1 899 1/24/2021 0.0.1 is deprecated because it is no longer maintained.