Skip to content

Auxiliary library for generating C# classes mapped from objects defined in LDtk files.

License

Notifications You must be signed in to change notification settings

codefrommars/ldtk_codegen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LDtk Code Generator

Auxiliary library for generating C# classes mapped from the objects defined in LDtk files.

Dependencies

How to use

//Load the ldtk file
string text = File.ReadAllText("Entities.ldtk");
LdtkJson ldtkJson = LdtkJson.FromJson(text);

//Configure a generator context
LdtkGeneratorContext ctx = new LdtkGeneratorContext();
ctx.TypeConverter = new LdtkTypeConverter();
ctx.CodeSettings.Namespace = "MyNamespace.Test";

//The output can be customized as well
SingleFileOutput fOut = new SingleFileOutput();
fOut.OutputDir = "src-gen";
fOut.Filename = "MyFileCode.cs";

//Run the generator
LdtkCodeGenerator cg = new LdtkCodeGenerator();
cg.GenerateCode(ldtkJson, ctx, fOut);

Extending

  • LdtkCodeCustomizer

    With the LdtkCodeCustomizer class it's possible to modify the generated classes

  • File Output

    • SingleFileOuput

    • MultiFileOutput

Future

License

MIT

About

Auxiliary library for generating C# classes mapped from objects defined in LDtk files.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages