irishbruse / ldtkmonogame Goto Github PK
View Code? Open in Web Editor NEWMonogame importer, renderer and code generator for LDtk Level editor
Home Page: http://ldtk.ethanconneely.com/
License: MIT License
Monogame importer, renderer and code generator for LDtk Level editor
Home Page: http://ldtk.ethanconneely.com/
License: MIT License
Would like to make my own world/level classes with your library
eg get intgrid
Todo
hi, I'm trying to write a LDtkRenderer for my game using nez based on LDtkRenderer.cs and I notice that when I tried to use RenderLevel instead of PrerenderLevel my game began to drop fps(down to 30fps). After a bit of digging, I found that GetTexture is just loading the same tileset that had been loaded before into the memory everytime the Renderer tried to draw a sprite. I think maybe you can use the "tilesets" field in there and create a list of tilesets and make it faster maybe. I'm trying to write my own too. and sorry for the broken english but hope this help
I propose a flag that allows me to use old-style namespaces. If you use older versions of C# for targeting console, the code produced by the generator doesn't work as it's not valid code. I would be willing to make a PR.
Examples:
Currently Generated :
namespace MyNamespace;
public void MyClass{}
Desired Generation or Optional Formet:
namespace MyNamespace {
public void MyClass{}
}
Missing LDtkMonogame.ContentPipeline.dll for importing with mgcb.
Please add support for the xnb files instead of exposing png files. An example would be use the tilesetrelpath but remove the extension and try to content.load(...) where the current tileset png path would be.
@ World.cs : LoadAllLayers(...) =>
texture = Texture2D.FromFile(GraphicsDevice, Path.Combine(this.projectFolder, jsonLayerInstance.TilesetRelPath));
I have multiple layers, one intended for the foreground and one intended for the background. The player need to render between these layers. Is there a way to pre-render individual layers, and subsequently draw individual layers?
Would the simplest way be making new instances of LDtkLevel for each layer?
I'm using source generation for my LDtk entities to have classes generated from their json objects, but when I try to get an object with an Entity reference as one of it's parameters, the game crashes with this error. If I remove the Entity Reference parameter, it works just fine.
System.NotSupportedException: JsonTypeInfo metadata for type 'LDtk.EntityReference' was not provided by TypeInfoResolver of type 'LDtk.LDtkJsonSourceGenerator'. If using source generation, ensure that all root types passed to the serializer have been annotated with 'JsonSerializableAttribute', along with any types that might be serialized polymorphically.
at System.Text.Json.ThrowHelper.ThrowNotSupportedException_NoMetadataForType(Type type, IJsonTypeInfoResolver resolver)
at System.Text.Json.JsonSerializerOptions.GetTypeInfoInternal(Type type, Boolean ensureConfigured, Nullable`1 ensureNotNull, Boolean resolveIfMutable, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializerOptions.GetTypeInfoForRootType(Type type, Boolean fallBackToNearestAncestorType)
at System.Text.Json.JsonSerializer.Deserialize(String json, Type returnType, JsonSerializerOptions options)
at LDtk.LDtkFieldParser.ParseCustomFields[T](T classFields, FieldInstance[] fields, LDtkLevel level)
at LDtk.LDtkFieldParser.ParseCustomEntityFields[T](T entity, FieldInstance[] fields, LDtkLevel level)
at LDtk.LDtkLevel.GetEntityFromInstance[T](EntityInstance entityInstance)
at LDtk.LDtkLevel.GetEntities[T]()
I've noticed that LDTK saves a relative path to the tileset files, i.e. "..\images\tileset.png".
When using this directly this line will fail:
LDtkMonogame/LDtk/Renderer/LDtkRenderer.cs
Line 171 in fadfecf
A solution would be to set LDtkLevel.FilePath and use that to allow relative loading. PR incoming.
Guides
Clear color
There are 2 issues relating to LDTKLevelData.
public class LDtkLevelData : ILDtkEntity
{
public string Identifier { get; set; }
public System.Guid Iid { get; set; }
public int Uid { get; set; }
public Vector2 Position { get; set; }
public Vector2 Size { get; set; }
public Vector2 Pivot { get; set; }
public Rectangle Tile { get; set; }
public Color SmartColor { get; set; }
public LevelType LevelType { get; set; }
}
getLevelData<T>(level)
or something but I don't see anything similar anywhere in the docs or repo.A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.