Merge pull request #10 from dcronqvist/add-docs

Add docs
This commit is contained in:
dcronqvist 2024-08-17 21:56:33 +02:00 committed by GitHub
commit 96ad2af667
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
145 changed files with 387 additions and 137 deletions

View file

@ -5,4 +5,11 @@ charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
insert_final_newline = true
[.github/**/*.yml]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true

41
.github/workflows/deploy-docs.yml vendored Normal file
View file

@ -0,0 +1,41 @@
on:
push:
branches:
- master
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
actions: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
deploy-docs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup DocFX
run: dotnet tool update -g docfx
- name: Build docs
run: make docs-build
- name: Upload docs
uses: actions/upload-pages-artifact@v3
with:
path: docs/_site
- name: Deploy docs
id: deployment
uses: actions/deploy-pages@v4

View file

@ -5,7 +5,7 @@ on:
- dev
jobs:
build:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -14,9 +14,9 @@ jobs:
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
run: dotnet restore src/DotTiled.sln
- name: Build
run: dotnet build --no-restore
run: dotnet build --no-restore src/DotTiled.sln
- name: Test
run: dotnet test --no-build --verbosity normal
run: dotnet test --no-build --verbosity normal src/DotTiled.sln

5
.gitignore vendored
View file

@ -3,6 +3,11 @@
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# Generated docs
docs/_site/
docs/api/
docs/index.md
# User-specific files
*.rsuser
*.suo

View file

@ -1,3 +0,0 @@
namespace DotTiled;
public class PointObject : Object { }

View file

@ -1,13 +0,0 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Text.Json;
namespace DotTiled;
internal partial class Tmj
{
}

View file

@ -1,15 +0,0 @@
# These are supported funding model platforms
github: [dcronqvist]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
polar: # Replace with a single Polar username
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
thanks_dev: # Replace with a single thanks.dev username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View file

@ -1,5 +1,12 @@
test:
dotnet test
dotnet test src/DotTiled.sln
docs-serve: docs-build
docfx docs/docfx.json --serve
docs-build:
cp README.md docs/index.md
docfx docs/docfx.json
BENCHMARK_SOURCES = DotTiled.Benchmark/Program.cs DotTiled.Benchmark/DotTiled.Benchmark.csproj
BENCHMARK_OUTPUTDIR = DotTiled.Benchmark/BenchmarkDotNet.Artifacts

View file

@ -8,8 +8,7 @@ DotTiled is designed to be a lightweight and efficient library that provides a s
- [Alternative libraries and comparison + benchmarks](#alternative-libraries-and-comparison)
- [Feature coverage comparison](#feature-coverage-comparison)
- [Quickstart](#quickstart)
- [Installing DotTiled](#installing-dottiled)
- [Installing DotTiled](#installing-dottiled)
# Alternative libraries and comparison
@ -74,9 +73,7 @@ Below is a comparison of the feature coverage of DotTiled and other similar libr
> [!NOTE]
> ✅ Full support. ⚠️ Partial support, see respective library for details about supported features. ❌ No support.
# Quickstart
### Installing DotTiled
# Installing DotTiled
DotTiled is available as a NuGet package. You can install it by using the NuGet Package Manager UI in Visual Studio, or equivalent, or using the following command for the .NET CLI:

46
docs/docfx.json Normal file
View file

@ -0,0 +1,46 @@
{
"metadata": [
{
"src": [
{
"src": "../src",
"files": [
"DotTiled/DotTiled.csproj"
]
}
],
"dest": "api"
}
],
"build": {
"content": [
{
"files": [
"**/*.{md,yml}"
],
"exclude": [
"_site/**"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"output": "_site",
"template": [
"default",
"modern",
"template"
],
"globalMetadata": {
"_appName": "DotTiled",
"_appTitle": "DotTiled",
"_enableSearch": true,
"pdf": true
}
}
}

View file

@ -0,0 +1 @@
# Loading a map

1
docs/docs/quickstart.md Normal file
View file

@ -0,0 +1 @@
# Quick Start

6
docs/docs/toc.yml Normal file
View file

@ -0,0 +1,6 @@
- name: Introduction
- href: ../index.md
- href: quickstart.md
- name: Essentials
- href: loading-a-map.md

4
docs/template/public/main.css vendored Normal file
View file

@ -0,0 +1,4 @@
body {
--bs-link-color-rgb: 66, 184, 131 !important;
--bs-link-hover-color-rgb: 64, 180, 128 !important;
}

4
docs/toc.yml Normal file
View file

@ -0,0 +1,4 @@
- name: Docs
href: docs/
- name: API
href: api/

View file

@ -39,19 +39,19 @@ namespace MyBenchmarks
[BenchmarkCategory("MapFromInMemoryTmxString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Map LoadWithDotTiledFromInMemoryTmxString()
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmxString()
{
using var stringReader = new StringReader(_tmxContents);
using var xmlReader = XmlReader.Create(stringReader);
using var mapReader = new DotTiled.TmxMapReader(xmlReader, _ => throw new Exception(), _ => throw new Exception(), []);
using var mapReader = new DotTiled.Serialization.Tmx.TmxMapReader(xmlReader, _ => throw new Exception(), _ => throw new Exception(), []);
return mapReader.ReadMap();
}
[BenchmarkCategory("MapFromInMemoryTmjString")]
[Benchmark(Baseline = true, Description = "DotTiled")]
public DotTiled.Map LoadWithDotTiledFromInMemoryTmjString()
public DotTiled.Model.Map LoadWithDotTiledFromInMemoryTmjString()
{
using var mapReader = new DotTiled.TmjMapReader(_tmjContents, _ => throw new Exception(), _ => throw new Exception(), []);
using var mapReader = new DotTiled.Serialization.Tmj.TmjMapReader(_tmjContents, _ => throw new Exception(), _ => throw new Exception(), []);
return mapReader.ReadMap();
}

View file

@ -1,3 +1,5 @@
using DotTiled.Model.Layers;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,3 +1,5 @@
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,3 +1,5 @@
using DotTiled.Model.Layers;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,5 +1,6 @@
using System.Collections;
using System.Numerics;
using DotTiled.Model;
namespace DotTiled.Tests;

View file

@ -1,20 +1,22 @@
using DotTiled.Model.Layers.Objects;
namespace DotTiled.Tests;
public static partial class DotTiledAssert
{
internal static void AssertObject(Object expected, Object actual)
internal static void AssertObject(Model.Layers.Objects.Object expected, Model.Layers.Objects.Object actual)
{
// Attributes
AssertEqual(expected.ID, actual.ID, nameof(Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(Object.Type));
AssertEqual(expected.X, actual.X, nameof(Object.X));
AssertEqual(expected.Y, actual.Y, nameof(Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(Object.Template));
AssertEqual(expected.ID, actual.ID, nameof(Model.Layers.Objects.Object.ID));
AssertEqual(expected.Name, actual.Name, nameof(Model.Layers.Objects.Object.Name));
AssertEqual(expected.Type, actual.Type, nameof(Model.Layers.Objects.Object.Type));
AssertEqual(expected.X, actual.X, nameof(Model.Layers.Objects.Object.X));
AssertEqual(expected.Y, actual.Y, nameof(Model.Layers.Objects.Object.Y));
AssertEqual(expected.Width, actual.Width, nameof(Model.Layers.Objects.Object.Width));
AssertEqual(expected.Height, actual.Height, nameof(Model.Layers.Objects.Object.Height));
AssertEqual(expected.Rotation, actual.Rotation, nameof(Model.Layers.Objects.Object.Rotation));
AssertEqual(expected.Visible, actual.Visible, nameof(Model.Layers.Objects.Object.Visible));
AssertEqual(expected.Template, actual.Template, nameof(Model.Layers.Objects.Object.Template));
AssertProperties(expected.Properties, actual.Properties);

View file

@ -1,3 +1,5 @@
using DotTiled.Model.Properties;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,3 +1,6 @@
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;
public static partial class DotTiledAssert

View file

@ -1,4 +1,6 @@
using System.Xml;
using DotTiled.Model.Properties;
using DotTiled.Model.Properties.CustomTypes;
namespace DotTiled.Tests;

View file

@ -1,3 +1,6 @@
using DotTiled.Model;
using DotTiled.Model.Layers;
namespace DotTiled.Tests;
public partial class TestData

View file

@ -1,4 +1,8 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
namespace DotTiled.Tests;

View file

@ -1,4 +1,8 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
using DotTiled.Model.Properties.CustomTypes;
namespace DotTiled.Tests;

View file

@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,4 +1,7 @@
using System.Globalization;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,4 +1,9 @@
using System.Numerics;
using DotTiled.Model;
using DotTiled.Model.Layers;
using DotTiled.Model.Layers.Objects;
using DotTiled.Model.Properties;
using DotTiled.Model.Tilesets;
namespace DotTiled.Tests;

View file

@ -1,3 +1,8 @@
using DotTiled.Model;
using DotTiled.Model.Properties.CustomTypes;
using DotTiled.Model.Tilesets;
using DotTiled.Serialization.Tmj;
namespace DotTiled.Tests;
public partial class TmjMapReaderTests

View file

@ -1,4 +1,8 @@
using System.Xml;
using DotTiled.Model;
using DotTiled.Model.Properties.CustomTypes;
using DotTiled.Model.Tilesets;
using DotTiled.Serialization.Tmx;
namespace DotTiled.Tests;

View file

@ -2,7 +2,7 @@ using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace DotTiled;
namespace DotTiled.Model;
public class Color : IParsable<Color>, IEquatable<Color>
{

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using DotTiled.Model.Properties;
namespace DotTiled;
namespace DotTiled.Model.Layers;
public abstract class BaseLayer
{

View file

@ -1,6 +1,6 @@
using System;
namespace DotTiled;
namespace DotTiled.Model.Layers;
public enum DataEncoding
{

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled;
namespace DotTiled.Model.Layers;
public class Group : BaseLayer
{

View file

@ -1,4 +1,6 @@
namespace DotTiled;
using DotTiled.Model.Tilesets;
namespace DotTiled.Model.Layers;
public class ImageLayer : BaseLayer
{

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using DotTiled.Model.Layers.Objects;
namespace DotTiled;
namespace DotTiled.Model.Layers;
public enum DrawOrder
{

View file

@ -1,3 +1,3 @@
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public class EllipseObject : Object { }

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using DotTiled.Model.Properties;
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public abstract class Object
{

View file

@ -0,0 +1,3 @@
namespace DotTiled.Model.Layers.Objects;
public class PointObject : Object { }

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Numerics;
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public class PolygonObject : Object
{

View file

@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Numerics;
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public class PolylineObject : Object
{

View file

@ -1,3 +1,3 @@
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public class RectangleObject : Object { }

View file

@ -1,6 +1,6 @@
using System.Globalization;
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public enum TextHorizontalAlignment

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Layers.Objects;
public class TileObject : Object
{

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Layers;
public class TileLayer : BaseLayer
{

View file

@ -1,7 +1,10 @@
using System.Collections.Generic;
using System.Globalization;
using DotTiled.Model.Layers;
using DotTiled.Model.Properties;
using DotTiled.Model.Tilesets;
namespace DotTiled;
namespace DotTiled.Model;
public enum MapOrientation
{

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Properties;
public class BoolProperty : IProperty
{

View file

@ -1,12 +1,12 @@
using System.Collections.Generic;
using System.Linq;
namespace DotTiled;
namespace DotTiled.Model.Properties;
public class ClassProperty : IProperty
{
public required string Name { get; set; }
public PropertyType Type => DotTiled.PropertyType.Class;
public PropertyType Type => Model.Properties.PropertyType.Class;
public required string PropertyType { get; set; }
public required Dictionary<string, IProperty> Properties { get; set; }

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Properties;
public class ColorProperty : IProperty
{

View file

@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
namespace DotTiled;
namespace DotTiled.Model.Properties.CustomTypes;
[Flags]
public enum CustomClassUseAs

View file

@ -1,6 +1,6 @@
using System.Collections.Generic;
namespace DotTiled;
namespace DotTiled.Model.Properties.CustomTypes;
public enum CustomEnumStorageType
{

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Properties.CustomTypes;
public abstract class CustomTypeDefinition
{

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Properties;
public class FileProperty : IProperty
{

View file

@ -1,4 +1,4 @@
namespace DotTiled;
namespace DotTiled.Model.Properties;
public class FloatProperty : IProperty
{

Some files were not shown because too many files have changed in this diff Show more