Skip to content

Commit b90ef43

Browse files
committed
[WIP] Neighborhoods
- A full rework of the neighborhoods system, introducing mayors. - Bezier Path Routing - New font renderer - Data Service modification - .NET Core support - Gamma Correction - Many other changes
1 parent d984274 commit b90ef43

File tree

599 files changed

+25547
-2651
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

599 files changed

+25547
-2651
lines changed

.gitmodules

+3
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44
[submodule "Other/libs/FSOMina.NET"]
55
path = Other/libs/FSOMina.NET
66
url = https://github.com/riperiperi/FSOMina.NET.git
7+
[submodule "Other/libs/assimp-net"]
8+
path = Other/libs/assimp-net
9+
url = https://github.com/kebby/assimp-net.git

Other/libs/MSDFData/FieldAtlas.cs

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
using Microsoft.Xna.Framework.Content;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.IO;
5+
using System.Linq;
6+
using System.Text;
7+
using System.Threading.Tasks;
8+
9+
namespace MSDFData
10+
{
11+
public class FieldAtlas
12+
{
13+
[ContentSerializer] private readonly int WidthBackend;
14+
[ContentSerializer] private readonly int HeightBackend;
15+
[ContentSerializer] private readonly int GlyphSizeBackend;
16+
[ContentSerializer] private readonly byte[] PNGDataBackend;
17+
[ContentSerializer] private readonly char[] CharMapBackend;
18+
19+
public FieldAtlas()
20+
{
21+
}
22+
23+
public FieldAtlas(int width, int height, int glyphSize, byte[] pngData, char[] charMap)
24+
{
25+
WidthBackend = width;
26+
HeightBackend = height;
27+
GlyphSizeBackend = glyphSize;
28+
PNGDataBackend = pngData;
29+
File.WriteAllBytes("test.png", pngData);
30+
CharMapBackend = charMap;
31+
}
32+
33+
public int Width => WidthBackend;
34+
public int Height => HeightBackend;
35+
public int GlyphSize => GlyphSizeBackend;
36+
public byte[] PNGData => PNGDataBackend;
37+
public char[] CharMap => CharMapBackend;
38+
}
39+
}

Other/libs/MSDFData/FieldFont.cs

+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using Microsoft.Xna.Framework.Content;
5+
6+
namespace MSDFData
7+
{
8+
public class FieldFont
9+
{
10+
[ContentSerializer] private readonly Dictionary<char, FieldGlyph> Glyphs;
11+
[ContentSerializer] private readonly string NameBackend;
12+
[ContentSerializer] private readonly float PxRangeBackend;
13+
[ContentSerializer] private readonly List<KerningPair> KerningPairsBackend;
14+
[ContentSerializer] private readonly FieldAtlas AtlasBackend;
15+
16+
public FieldFont()
17+
{
18+
}
19+
20+
public FieldFont(string name, IReadOnlyCollection<FieldGlyph> glyphs, IReadOnlyCollection<KerningPair> kerningPairs, float pxRange, FieldAtlas atlas)
21+
{
22+
this.NameBackend = name;
23+
this.PxRangeBackend = pxRange;
24+
this.KerningPairsBackend = kerningPairs.ToList();
25+
this.AtlasBackend = atlas;
26+
27+
this.Glyphs = new Dictionary<char, FieldGlyph>(glyphs.Count);
28+
foreach (var glyph in glyphs)
29+
{
30+
this.Glyphs.Add(glyph.Character, glyph);
31+
}
32+
}
33+
34+
/// <summary>
35+
/// Name of the font
36+
/// </summary>
37+
public string Name => this.NameBackend;
38+
39+
/// <summary>
40+
/// Distance field effect range in pixels
41+
/// </summary>
42+
public float PxRange => this.PxRangeBackend;
43+
44+
/// <summary>
45+
/// Kerning pairs available in this font
46+
/// </summary>
47+
public IReadOnlyList<KerningPair> KerningPairs => this.KerningPairsBackend;
48+
49+
/// <summary>
50+
/// Characters supported by this font
51+
/// </summary>
52+
[ContentSerializerIgnore]
53+
public IEnumerable<char> SupportedCharacters => this.Glyphs.Keys;
54+
55+
private Dictionary<string, KerningPair> StringToPairBackend;
56+
[ContentSerializerIgnore]
57+
public Dictionary<string, KerningPair> StringToPair {
58+
get {
59+
if (StringToPairBackend == null)
60+
{
61+
StringToPairBackend = KerningPairs.ToDictionary(x => new string(new char[] { x.Left, x.Right }));
62+
}
63+
return StringToPairBackend;
64+
}
65+
}
66+
67+
/// <summary>
68+
/// Characters supported by this font
69+
/// </summary>
70+
public FieldAtlas Atlas => AtlasBackend;
71+
72+
/// <summary>
73+
/// Returns the glyph for the given character, or returns null when the glyph is not supported by this font
74+
/// </summary>
75+
public FieldGlyph GetGlyph(char c)
76+
{
77+
if (this.Glyphs.TryGetValue(c, out FieldGlyph glyph))
78+
{
79+
return glyph;
80+
}
81+
82+
return null;
83+
}
84+
}
85+
}

Other/libs/MSDFData/FieldGlyph.cs

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using Microsoft.Xna.Framework.Content;
2+
3+
namespace MSDFData
4+
{
5+
public class FieldGlyph
6+
{
7+
[ContentSerializer] private readonly char CharacterBackend;
8+
[ContentSerializer] private readonly int AtlasIndexBackend;
9+
[ContentSerializer] private readonly Metrics MetricsBackend;
10+
11+
public FieldGlyph()
12+
{
13+
14+
}
15+
16+
public FieldGlyph(char character, int atlasIndex, Metrics metrics)
17+
{
18+
this.CharacterBackend = character;
19+
this.AtlasIndexBackend = atlasIndex;
20+
this.MetricsBackend = metrics;
21+
}
22+
23+
/// <summary>
24+
/// The character this glyph represents
25+
/// </summary>
26+
public char Character => this.CharacterBackend;
27+
/// <summary>
28+
/// Index of this character in the atlas.
29+
/// </summary>
30+
public int AtlasIndex => this.AtlasIndexBackend;
31+
/// <summary>
32+
/// Metrics for this character
33+
/// </summary>
34+
public Metrics Metrics => this.MetricsBackend;
35+
}
36+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
using System.Collections.Generic;
2+
using System.Linq;
3+
4+
namespace MSDFData
5+
{
6+
public class FontDescription
7+
{
8+
public FontDescription(string path, params char[] characters)
9+
{
10+
this.Path = path;
11+
this.Characters = characters.ToList().AsReadOnly();
12+
}
13+
14+
public string Path { get; }
15+
public IReadOnlyList<char> Characters { get; }
16+
}
17+
}

Other/libs/MSDFData/KerningPair.cs

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Microsoft.Xna.Framework.Content;
2+
3+
namespace MSDFData
4+
{
5+
public class KerningPair
6+
{
7+
[ContentSerializer] private readonly char LeftBackend;
8+
[ContentSerializer] private readonly char RightBackend;
9+
[ContentSerializer] private readonly float AdvanceBackend;
10+
11+
public KerningPair()
12+
{
13+
14+
}
15+
16+
public KerningPair(char left, char right, float advance)
17+
{
18+
this.LeftBackend = left;
19+
this.RightBackend = right;
20+
this.AdvanceBackend = advance;
21+
}
22+
23+
public char Left => this.LeftBackend;
24+
public char Right => this.RightBackend;
25+
public float Advance => this.AdvanceBackend;
26+
}
27+
}

Other/libs/MSDFData/MSDFData.csproj

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{EABEA510-3E53-4F19-9F0B-75C5CA9DFA3B}</ProjectGuid>
8+
<OutputType>Library</OutputType>
9+
<AppDesignerFolder>Properties</AppDesignerFolder>
10+
<RootNamespace>MSDFData</RootNamespace>
11+
<AssemblyName>MSDFData</AssemblyName>
12+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
13+
<FileAlignment>512</FileAlignment>
14+
</PropertyGroup>
15+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<DebugType>pdbonly</DebugType>
26+
<Optimize>true</Optimize>
27+
<OutputPath>bin\Release\</OutputPath>
28+
<DefineConstants>TRACE</DefineConstants>
29+
<ErrorReport>prompt</ErrorReport>
30+
<WarningLevel>4</WarningLevel>
31+
</PropertyGroup>
32+
<ItemGroup>
33+
<Reference Include="System" />
34+
<Reference Include="System.Core" />
35+
<Reference Include="System.Xml.Linq" />
36+
<Reference Include="System.Data.DataSetExtensions" />
37+
<Reference Include="Microsoft.CSharp" />
38+
<Reference Include="System.Data" />
39+
<Reference Include="System.Net.Http" />
40+
<Reference Include="System.Xml" />
41+
</ItemGroup>
42+
<ItemGroup>
43+
<Compile Include="FieldAtlas.cs" />
44+
<Compile Include="FieldFont.cs" />
45+
<Compile Include="FieldGlyph.cs" />
46+
<Compile Include="FontDescription.cs" />
47+
<Compile Include="KerningPair.cs" />
48+
<Compile Include="Metrics.cs" />
49+
<Compile Include="Properties\AssemblyInfo.cs" />
50+
</ItemGroup>
51+
<ItemGroup>
52+
<None Include="packages.config" />
53+
</ItemGroup>
54+
<ItemGroup>
55+
<ProjectReference Include="..\FSOMonoGame\MonoGame.Framework\MonoGame.Framework.Windows.csproj">
56+
<Project>{7de47032-a904-4c29-bd22-2d235e8d91ba}</Project>
57+
<Name>MonoGame.Framework.Windows</Name>
58+
</ProjectReference>
59+
</ItemGroup>
60+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
61+
</Project>

Other/libs/MSDFData/Metrics.cs

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
using Microsoft.Xna.Framework;
2+
using Microsoft.Xna.Framework.Content;
3+
4+
namespace MSDFData
5+
{
6+
public class Metrics
7+
{
8+
[ContentSerializer] private readonly float AdvanceBackend;
9+
[ContentSerializer] private readonly float ScaleBackend;
10+
[ContentSerializer] private readonly Vector2 TranslationBackend;
11+
12+
public Metrics()
13+
{
14+
15+
}
16+
17+
public Metrics(float advance, float scale, Vector2 translation)
18+
{
19+
this.AdvanceBackend = advance;
20+
this.ScaleBackend = scale;
21+
this.TranslationBackend = translation;
22+
}
23+
24+
public float Advance => this.AdvanceBackend;
25+
public float Scale => this.ScaleBackend;
26+
public Vector2 Translation => this.TranslationBackend;
27+
}
28+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
using System.Reflection;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
// General Information about an assembly is controlled through the following
6+
// set of attributes. Change these attribute values to modify the information
7+
// associated with an assembly.
8+
[assembly: AssemblyTitle("MSDFData")]
9+
[assembly: AssemblyDescription("")]
10+
[assembly: AssemblyConfiguration("")]
11+
[assembly: AssemblyCompany("")]
12+
[assembly: AssemblyProduct("MSDFData")]
13+
[assembly: AssemblyCopyright("Copyright © 2018")]
14+
[assembly: AssemblyTrademark("")]
15+
[assembly: AssemblyCulture("")]
16+
17+
// Setting ComVisible to false makes the types in this assembly not visible
18+
// to COM components. If you need to access a type in this assembly from
19+
// COM, set the ComVisible attribute to true on that type.
20+
[assembly: ComVisible(false)]
21+
22+
// The following GUID is for the ID of the typelib if this project is exposed to COM
23+
[assembly: Guid("eabea510-3e53-4f19-9f0b-75c5ca9dfa3b")]
24+
25+
// Version information for an assembly consists of the following four values:
26+
//
27+
// Major Version
28+
// Minor Version
29+
// Build Number
30+
// Revision
31+
//
32+
// You can specify all the values or you can default the Build and Revision Numbers
33+
// by using the '*' as shown below:
34+
// [assembly: AssemblyVersion("1.0.*")]
35+
[assembly: AssemblyVersion("1.0.0.0")]
36+
[assembly: AssemblyFileVersion("1.0.0.0")]

Other/libs/MSDFData/packages.config

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<packages>
3+
<package id="MonoGame.Framework.Content.Pipeline.Portable" version="3.7.0.1708" targetFramework="net45" />
4+
<package id="MonoGame.Framework.Portable" version="3.7.0.1708" targetFramework="net45" />
5+
</packages>

0 commit comments

Comments
 (0)