Skip to content

Commit

Permalink
[WIP] Neighborhoods
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
riperiperi committed Nov 22, 2018
1 parent d984274 commit b90ef43
Show file tree
Hide file tree
Showing 599 changed files with 25,547 additions and 2,651 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
[submodule "Other/libs/FSOMina.NET"]
path = Other/libs/FSOMina.NET
url = https://github.com/riperiperi/FSOMina.NET.git
[submodule "Other/libs/assimp-net"]
path = Other/libs/assimp-net
url = https://github.com/kebby/assimp-net.git
2 changes: 1 addition & 1 deletion Other/libs/FSOMina.NET
39 changes: 39 additions & 0 deletions Other/libs/MSDFData/FieldAtlas.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using Microsoft.Xna.Framework.Content;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MSDFData
{
public class FieldAtlas
{
[ContentSerializer] private readonly int WidthBackend;
[ContentSerializer] private readonly int HeightBackend;
[ContentSerializer] private readonly int GlyphSizeBackend;
[ContentSerializer] private readonly byte[] PNGDataBackend;
[ContentSerializer] private readonly char[] CharMapBackend;

public FieldAtlas()
{
}

public FieldAtlas(int width, int height, int glyphSize, byte[] pngData, char[] charMap)
{
WidthBackend = width;
HeightBackend = height;
GlyphSizeBackend = glyphSize;
PNGDataBackend = pngData;
File.WriteAllBytes("test.png", pngData);
CharMapBackend = charMap;
}

public int Width => WidthBackend;
public int Height => HeightBackend;
public int GlyphSize => GlyphSizeBackend;
public byte[] PNGData => PNGDataBackend;
public char[] CharMap => CharMapBackend;
}
}
85 changes: 85 additions & 0 deletions Other/libs/MSDFData/FieldFont.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework.Content;

namespace MSDFData
{
public class FieldFont
{
[ContentSerializer] private readonly Dictionary<char, FieldGlyph> Glyphs;
[ContentSerializer] private readonly string NameBackend;
[ContentSerializer] private readonly float PxRangeBackend;
[ContentSerializer] private readonly List<KerningPair> KerningPairsBackend;
[ContentSerializer] private readonly FieldAtlas AtlasBackend;

public FieldFont()
{
}

public FieldFont(string name, IReadOnlyCollection<FieldGlyph> glyphs, IReadOnlyCollection<KerningPair> kerningPairs, float pxRange, FieldAtlas atlas)
{
this.NameBackend = name;
this.PxRangeBackend = pxRange;
this.KerningPairsBackend = kerningPairs.ToList();
this.AtlasBackend = atlas;

this.Glyphs = new Dictionary<char, FieldGlyph>(glyphs.Count);
foreach (var glyph in glyphs)
{
this.Glyphs.Add(glyph.Character, glyph);
}
}

/// <summary>
/// Name of the font
/// </summary>
public string Name => this.NameBackend;

/// <summary>
/// Distance field effect range in pixels
/// </summary>
public float PxRange => this.PxRangeBackend;

/// <summary>
/// Kerning pairs available in this font
/// </summary>
public IReadOnlyList<KerningPair> KerningPairs => this.KerningPairsBackend;

/// <summary>
/// Characters supported by this font
/// </summary>
[ContentSerializerIgnore]
public IEnumerable<char> SupportedCharacters => this.Glyphs.Keys;

private Dictionary<string, KerningPair> StringToPairBackend;
[ContentSerializerIgnore]
public Dictionary<string, KerningPair> StringToPair {
get {
if (StringToPairBackend == null)
{
StringToPairBackend = KerningPairs.ToDictionary(x => new string(new char[] { x.Left, x.Right }));
}
return StringToPairBackend;
}
}

/// <summary>
/// Characters supported by this font
/// </summary>
public FieldAtlas Atlas => AtlasBackend;

/// <summary>
/// Returns the glyph for the given character, or returns null when the glyph is not supported by this font
/// </summary>
public FieldGlyph GetGlyph(char c)
{
if (this.Glyphs.TryGetValue(c, out FieldGlyph glyph))
{
return glyph;
}

return null;
}
}
}
36 changes: 36 additions & 0 deletions Other/libs/MSDFData/FieldGlyph.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Microsoft.Xna.Framework.Content;

namespace MSDFData
{
public class FieldGlyph
{
[ContentSerializer] private readonly char CharacterBackend;
[ContentSerializer] private readonly int AtlasIndexBackend;
[ContentSerializer] private readonly Metrics MetricsBackend;

public FieldGlyph()
{

}

public FieldGlyph(char character, int atlasIndex, Metrics metrics)
{
this.CharacterBackend = character;
this.AtlasIndexBackend = atlasIndex;
this.MetricsBackend = metrics;
}

/// <summary>
/// The character this glyph represents
/// </summary>
public char Character => this.CharacterBackend;
/// <summary>
/// Index of this character in the atlas.
/// </summary>
public int AtlasIndex => this.AtlasIndexBackend;
/// <summary>
/// Metrics for this character
/// </summary>
public Metrics Metrics => this.MetricsBackend;
}
}
17 changes: 17 additions & 0 deletions Other/libs/MSDFData/FontDescription.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System.Collections.Generic;
using System.Linq;

namespace MSDFData
{
public class FontDescription
{
public FontDescription(string path, params char[] characters)
{
this.Path = path;
this.Characters = characters.ToList().AsReadOnly();
}

public string Path { get; }
public IReadOnlyList<char> Characters { get; }
}
}
27 changes: 27 additions & 0 deletions Other/libs/MSDFData/KerningPair.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Microsoft.Xna.Framework.Content;

namespace MSDFData
{
public class KerningPair
{
[ContentSerializer] private readonly char LeftBackend;
[ContentSerializer] private readonly char RightBackend;
[ContentSerializer] private readonly float AdvanceBackend;

public KerningPair()
{

}

public KerningPair(char left, char right, float advance)
{
this.LeftBackend = left;
this.RightBackend = right;
this.AdvanceBackend = advance;
}

public char Left => this.LeftBackend;
public char Right => this.RightBackend;
public float Advance => this.AdvanceBackend;
}
}
61 changes: 61 additions & 0 deletions Other/libs/MSDFData/MSDFData.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EABEA510-3E53-4F19-9F0B-75C5CA9DFA3B}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>MSDFData</RootNamespace>
<AssemblyName>MSDFData</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="FieldAtlas.cs" />
<Compile Include="FieldFont.cs" />
<Compile Include="FieldGlyph.cs" />
<Compile Include="FontDescription.cs" />
<Compile Include="KerningPair.cs" />
<Compile Include="Metrics.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FSOMonoGame\MonoGame.Framework\MonoGame.Framework.Windows.csproj">
<Project>{7de47032-a904-4c29-bd22-2d235e8d91ba}</Project>
<Name>MonoGame.Framework.Windows</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
28 changes: 28 additions & 0 deletions Other/libs/MSDFData/Metrics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;

namespace MSDFData
{
public class Metrics
{
[ContentSerializer] private readonly float AdvanceBackend;
[ContentSerializer] private readonly float ScaleBackend;
[ContentSerializer] private readonly Vector2 TranslationBackend;

public Metrics()
{

}

public Metrics(float advance, float scale, Vector2 translation)
{
this.AdvanceBackend = advance;
this.ScaleBackend = scale;
this.TranslationBackend = translation;
}

public float Advance => this.AdvanceBackend;
public float Scale => this.ScaleBackend;
public Vector2 Translation => this.TranslationBackend;
}
}
36 changes: 36 additions & 0 deletions Other/libs/MSDFData/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("MSDFData")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MSDFData")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]

// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("eabea510-3e53-4f19-9f0b-75c5ca9dfa3b")]

// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
5 changes: 5 additions & 0 deletions Other/libs/MSDFData/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.Content.Pipeline.Portable" version="3.7.0.1708" targetFramework="net45" />
<package id="MonoGame.Framework.Portable" version="3.7.0.1708" targetFramework="net45" />
</packages>
Loading

0 comments on commit b90ef43

Please sign in to comment.