百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

TiledSharp

> 开发工具
开源

用于解析和导入由 Tiled(一种瓦片地图生成工具)生成的 TMX 和 TSX 文件的 C# 库

340 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

用于解析和导入由 Tiled(一种瓦片地图生成工具)生成的 TMX 和 TSX 文件的 C# 库

TiledSharp

A .NET C# library for importing Tiled TMX tile maps

NOTE: This project is no longer being maintained. Please consider using the TiledCS_ project, which has a similar API and supports a greater number of features.

.. _TiledCS: https://github.com/TheBoneJarmer/TiledCS

About TiledSharp

TiledSharp is a .NET C# library for importing TMX_ tilemaps and TSX tilesets generated by Tiled_, a tile map generation tool. The data is saved as a TmxMap_ object, whose structure closely resembles the original TMX file.

As a generic TMX and TSX parser, TiledSharp does not render the maps or depend on any external framework beyond .NET, such as Windows, XNA/MonoGame, Unity, or PSM. However, it can be used as an interface between TMX data and external games.

Usage

To import a TMX file into your C# application:

  • Include a reference to TiledSharp. You can either incorporare it directory into your own project, or you can pre-compile it and include the DLL.

  • Import the TiledSharp namespace (optional):

    .. code:: csharp

    using TiledSharp;

  • Create a Map object using the constructor:

    .. code:: csharp

    var map = new TmxMap("someMap.tmx");

    TiledSharp supports both resource names and file paths, and should work as expected in most situations. For more details, please consult the wiki.

  • Access the TMX data using the Map fields. Principal classes can be accessed by either name or index:

    .. code:: csharp

    var map = new TmxMap("someMap.tmx"); var version = map.Version; var myTileset = map.Tilesets["myTileset"]; var myLayer = map.Layers[2]; var hiddenChest = map.ObjectGroups["Chests"].Objects["hiddenChest"];

Map data fields correspond closely to the TMX file structure. For a complete listing, see the documentation_.

Although TiledSharp can manage elements with the same name, it is not recommended. For more information, see the TmxList_ specification.

Examples

  • Github user Temeez_ has provided a simple example of a MonoGame project using TiledSharp:

    https://github.com/Temeez/TiledSharp-MonoGame-Example

  • Tesserae_ was an attempt to create a general TMX renderer for MonoGame. I still don't feel that it's ready for general use, but it may help others to develop their own renderers.

    An example game using Tesserae is available here:

    https://github.com/marshallward/DemoGame

Notes

TiledSharp parses XML files produced by Tiled_, an open-source (GPL) tile map editor developed and maintained by Thorbjørn Lindeijer.

Licensing

TiledSharp_ is distributed under the Apache 2.0 License_. The code can be used freely in any project, including commercial software, and does not place any restrictions on your own code. But any changes to TiledSharp must be documented explicitly.

Attribution is not necessary, but always appreciated.

Contact

Marshall Ward

.. _TMX: https://github.com/bjorn/tiled/wiki/TMX-Map-Format .. _Tiled: http://mapeditor.org .. _TmxMap: http://marshallward.github.io/TiledSharp/classTiledSharp_1_1TmxMap.html .. _TiledSharp: https://github.com/marshallward/TiledSharp .. _documentation: http://marshallward.github.io/TiledSharp/index.html .. _TiledSharp Data Hierarchy: https://github.com/marshallward/TiledSharp/wiki/TiledSharp-Data-Hierarchy .. _TmxList: https://github.com/marshallward/TiledSharp/wiki/TmxList .. _DotNetZip: http://dotnetzip.codeplex.com .. _Temeez: https://github.com/Temeez .. _Tesserae: https://github.com/marshallward/Tesserae .. _Apache 2.0 License: http://www.apache.org/licenses/LICENSE-2.0.txt .. _Microsoft Public License: http://www.microsoft.com/en-us/openness/licenses.aspx#MPL

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#tiled-map-editortmx

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类开发工具
定价开源

> 相关工具

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具