Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Engine fleshed out, Tiled maps, textures, basic UI
  • Loading branch information
helluvamatt committed Apr 14, 2019
1 parent 1299567 commit f256499
Show file tree
Hide file tree
Showing 68 changed files with 5,187 additions and 922 deletions.
6 changes: 6 additions & 0 deletions MazeGame/App.config
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"></assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.1"/></startup></configuration>
118 changes: 118 additions & 0 deletions MazeGame/Content/Assets.cs
@@ -0,0 +1,118 @@
namespace MazeGame.Content
{
internal class Assets
{
public static class Fonts
{
public const string CinzelDecorative = @"fonts\CinzelDecorative";
public const string Dynalight = @"fonts\Dynalight";
public const string NothingYouCouldDo = @"fonts\NothingYouCouldDo";
public const string OpenSansCondensed = @"fonts\OpenSansCondensed";
}
public static class Gfx
{
public static class Slash
{
public const string BEHIND_quiver = @"gfx\slash\BEHIND_quiver";
public const string BELT_leather = @"gfx\slash\BELT_leather";
public const string BELT_rope = @"gfx\slash\BELT_rope";
public const string BODY_human = @"gfx\slash\BODY_human";
public const string BODY_skeleton = @"gfx\slash\BODY_skeleton";
public const string FEET_plate_armor_shoes = @"gfx\slash\FEET_plate_armor_shoes";
public const string FEET_shoes_brown = @"gfx\slash\FEET_shoes_brown";
public const string HANDS_plate_armor_gloves = @"gfx\slash\HANDS_plate_armor_gloves";
public const string HEAD_chain_armor_helmet = @"gfx\slash\HEAD_chain_armor_helmet";
public const string HEAD_chain_armor_hood = @"gfx\slash\HEAD_chain_armor_hood";
public const string HEAD_hair_blonde = @"gfx\slash\HEAD_hair_blonde";
public const string HEAD_leather_armor_hat = @"gfx\slash\HEAD_leather_armor_hat";
public const string HEAD_plate_armor_helmet = @"gfx\slash\HEAD_plate_armor_helmet";
public const string HEAD_robe_hood = @"gfx\slash\HEAD_robe_hood";
public const string LEGS_pants_greenish = @"gfx\slash\LEGS_pants_greenish";
public const string LEGS_plate_armor_pants = @"gfx\slash\LEGS_plate_armor_pants";
public const string LEGS_robe_skirt = @"gfx\slash\LEGS_robe_skirt";
public const string TORSO_chain_armor_jacket_purple = @"gfx\slash\TORSO_chain_armor_jacket_purple";
public const string TORSO_chain_armor_torso = @"gfx\slash\TORSO_chain_armor_torso";
public const string TORSO_leather_armor_bracers = @"gfx\slash\TORSO_leather_armor_bracers";
public const string TORSO_leather_armor_shirt_white = @"gfx\slash\TORSO_leather_armor_shirt_white";
public const string TORSO_leather_armor_shoulders = @"gfx\slash\TORSO_leather_armor_shoulders";
public const string TORSO_leather_armor_torso = @"gfx\slash\TORSO_leather_armor_torso";
public const string TORSO_plate_armor_arms_shoulders = @"gfx\slash\TORSO_plate_armor_arms_shoulders";
public const string TORSO_plate_armor_torso = @"gfx\slash\TORSO_plate_armor_torso";
public const string TORSO_robe_shirt_brown = @"gfx\slash\TORSO_robe_shirt_brown";
public const string WEAPON_dagger = @"gfx\slash\WEAPON_dagger";
}
public static class Thrust
{
public const string BEHIND_quiver = @"gfx\thrust\BEHIND_quiver";
public const string BELT_leather = @"gfx\thrust\BELT_leather";
public const string BELT_rope = @"gfx\thrust\BELT_rope";
public const string BODY_animation = @"gfx\thrust\BODY_animation";
public const string FEET_plate_armor_shoes = @"gfx\thrust\FEET_plate_armor_shoes";
public const string FEET_shoes_brown = @"gfx\thrust\FEET_shoes_brown";
public const string HANDS_plate_armor_gloves = @"gfx\thrust\HANDS_plate_armor_gloves";
public const string HEAD_chain_armor_helmet = @"gfx\thrust\HEAD_chain_armor_helmet";
public const string HEAD_chain_armor_hood = @"gfx\thrust\HEAD_chain_armor_hood";
public const string HEAD_hair_blonde = @"gfx\thrust\HEAD_hair_blonde";
public const string HEAD_leather_armor_hat = @"gfx\thrust\HEAD_leather_armor_hat";
public const string HEAD_plate_armor_helmet = @"gfx\thrust\HEAD_plate_armor_helmet";
public const string HEAD_robe_hood = @"gfx\thrust\HEAD_robe_hood";
public const string LEGS_pants_greenish = @"gfx\thrust\LEGS_pants_greenish";
public const string LEGS_plate_armor_pants = @"gfx\thrust\LEGS_plate_armor_pants";
public const string LEGS_robe_skirt = @"gfx\thrust\LEGS_robe_skirt";
public const string TORSO_chain_armor_jacket_purple = @"gfx\thrust\TORSO_chain_armor_jacket_purple";
public const string TORSO_chain_armor_torso = @"gfx\thrust\TORSO_chain_armor_torso";
public const string TORSO_leather_armor_bracers = @"gfx\thrust\TORSO_leather_armor_bracers";
public const string TORSO_leather_armor_shirt_white = @"gfx\thrust\TORSO_leather_armor_shirt_white";
public const string TORSO_leather_armor_shoulders = @"gfx\thrust\TORSO_leather_armor_shoulders";
public const string TORSO_leather_armor_torso = @"gfx\thrust\TORSO_leather_armor_torso";
public const string TORSO_plate_armor_arms_shoulders = @"gfx\thrust\TORSO_plate_armor_arms_shoulders";
public const string TORSO_plate_armor_torso = @"gfx\thrust\TORSO_plate_armor_torso";
public const string TORSO_robe_shirt_brown = @"gfx\thrust\TORSO_robe_shirt_brown";
public const string WEAPON_shield_cutout_body = @"gfx\thrust\WEAPON_shield_cutout_body";
public const string WEAPON_shield_cutout_chain_armor_helmet = @"gfx\thrust\WEAPON_shield_cutout_chain_armor_helmet";
public const string WEAPON_spear = @"gfx\thrust\WEAPON_spear";
public const string WEAPON_staff = @"gfx\thrust\WEAPON_staff";
}
public static class Walkcycle
{
public const string BEHIND_quiver = @"gfx\walkcycle\BEHIND_quiver";
public const string BELT_leather = @"gfx\walkcycle\BELT_leather";
public const string BELT_rope = @"gfx\walkcycle\BELT_rope";
public const string BODY_male = @"gfx\walkcycle\BODY_male";
public const string BODY_skeleton = @"gfx\walkcycle\BODY_skeleton";
public const string FEET_plate_armor_shoes = @"gfx\walkcycle\FEET_plate_armor_shoes";
public const string FEET_shoes_brown = @"gfx\walkcycle\FEET_shoes_brown";
public const string HANDS_plate_armor_gloves = @"gfx\walkcycle\HANDS_plate_armor_gloves";
public const string HEAD_chain_armor_helmet = @"gfx\walkcycle\HEAD_chain_armor_helmet";
public const string HEAD_chain_armor_hood = @"gfx\walkcycle\HEAD_chain_armor_hood";
public const string HEAD_hair_blonde = @"gfx\walkcycle\HEAD_hair_blonde";
public const string HEAD_leather_armor_hat = @"gfx\walkcycle\HEAD_leather_armor_hat";
public const string HEAD_plate_armor_helmet = @"gfx\walkcycle\HEAD_plate_armor_helmet";
public const string HEAD_robe_hood = @"gfx\walkcycle\HEAD_robe_hood";
public const string LEGS_pants_greenish = @"gfx\walkcycle\LEGS_pants_greenish";
public const string LEGS_plate_armor_pants = @"gfx\walkcycle\LEGS_plate_armor_pants";
public const string LEGS_robe_skirt = @"gfx\walkcycle\LEGS_robe_skirt";
public const string TORSO_chain_armor_jacket_purple = @"gfx\walkcycle\TORSO_chain_armor_jacket_purple";
public const string TORSO_chain_armor_torso = @"gfx\walkcycle\TORSO_chain_armor_torso";
public const string TORSO_leather_armor_bracers = @"gfx\walkcycle\TORSO_leather_armor_bracers";
public const string TORSO_leather_armor_shirt_white = @"gfx\walkcycle\TORSO_leather_armor_shirt_white";
public const string TORSO_leather_armor_shoulders = @"gfx\walkcycle\TORSO_leather_armor_shoulders";
public const string TORSO_leather_armor_torso = @"gfx\walkcycle\TORSO_leather_armor_torso";
public const string TORSO_plate_armor_arms_shoulders = @"gfx\walkcycle\TORSO_plate_armor_arms_shoulders";
public const string TORSO_plate_armor_torso = @"gfx\walkcycle\TORSO_plate_armor_torso";
public const string TORSO_robe_shirt_brown = @"gfx\walkcycle\TORSO_robe_shirt_brown";
public const string WEAPON_shield_cutout_body = @"gfx\walkcycle\WEAPON_shield_cutout_body";
public const string WEAPON_shield_cutout_chain_armor_helmet = @"gfx\walkcycle\WEAPON_shield_cutout_chain_armor_helmet";
}
public const string misc_atlas = @"gfx\misc_atlas";
public const string terrain_atlas = @"gfx\terrain_atlas";
public const string ui = @"gfx\ui";
}
public static class Levels
{
public const string town = @"levels\town";
}

}
}

120 changes: 120 additions & 0 deletions MazeGame/Content/Assets.tt
@@ -0,0 +1,120 @@
<#@ template language="C#" hostSpecific="true" #>
<#@ assembly name="System.Core" #>
<#@ import namespace="System.Linq" #>
<#@ import namespace="System.Text" #>
<#@ import namespace="System.Collections.Generic" #>
<#@ import namespace="System.IO" #>
<#@ import namespace="System.Globalization" #>
<#@ import namespace="System.Text.RegularExpressions" #>
<# var sourceFolders = new string[] { "bin/DesktopGL", "." }; #>
namespace MazeGame.Content
{
internal class Assets
{
<#

// loop through all of our sourceFolders
foreach( var sourceFolder in sourceFolders )
{
var directories = Directory.GetDirectories( Host.ResolvePath( sourceFolder ) );
// loop through all the directories in our sourceFolder
foreach( var dir in directories )
{
var dirName = new DirectoryInfo( dir ).Name.ToLower();
if( dirName == "bin" || dirName == "obj" || dirName == "content" )
continue;

// dont delve into directories that don't contan xnb files
var xnbFiles = Directory.GetFiles( dir, "*.xnb", SearchOption.AllDirectories );
if( xnbFiles.Length == 0 )
continue;

// start off the recursive directory printing
printDirectoryClass( dir, 2, sourceFolder );
}

// handle any files in the root sourceFolder
printContentFiles( Host.ResolvePath( sourceFolder ), 2, Host.ResolvePath( sourceFolder ) );
}

#>

}
}

<#+
string indent = " ";

// recursively creates a class for each directory
void printDirectoryClass( string dir, int depth, string sourceFolder )
{
var dirInfo = new DirectoryInfo( dir );
var firstIndent = string.Concat(Enumerable.Repeat(indent, depth));
var className = generateClassName( dirInfo.Name, true );
WriteLine( "{0}public static class {1}{2}{3}{{", firstIndent, className, Environment.NewLine, firstIndent );

// handle subdirectories
foreach( var subdir in Directory.GetDirectories( dir ) )
printDirectoryClass( subdir, depth + 1, sourceFolder );

// handle files
printContentFiles( dir, depth + 1, sourceFolder );

WriteLine( "{0}}}", firstIndent );
}


// prints a const string for each file in the directory
void printContentFiles( string dir, int depth, string sourceFolder )
{
var firstIndent = string.Concat(Enumerable.Repeat(indent, depth));

foreach( var file in Directory.GetFiles( dir, "*.xnb" ) )
{
// clear out all of the path up to the sourceFolder so we get just the relative path to the Content folder
var finalPath = file.Substring( file.IndexOf( sourceFolder ) + sourceFolder.Length )
.Replace( ".xnb", string.Empty );
var fileInfo = new FileInfo( file );
var fileName = fileInfo.Name.Replace( ".xnb", string.Empty );
var className = generateClassName( fileName, false );

if( finalPath[0] == '/' || finalPath[0] == '\\' )
finalPath = finalPath.Substring( 1 );

WriteLine( "{0}public const string {1} = @\"{2}\";", firstIndent, className, finalPath );
}
}


string stripInvalidPathChars( string input )
{
var invalidChars = Path.GetInvalidPathChars();
return new string( input.Where( m => !invalidChars.Contains( m ) ).ToArray<char>() );
}


string stripInvalidFilenameChars( string input )
{
var invalidChars = Path.GetInvalidFileNameChars();
return new string( input.Where( m => !invalidChars.Contains( m ) ).ToArray<char>() );
}


// attempts to generate a proper path name
string generateClassName( string className, bool uppercaseFirstChar )
{
// handle upper or lower casing the first char in the className
if( uppercaseFirstChar && char.IsLower( className[0] ) )
className = char.ToUpper( className[0] ) + className.Substring( 1 );

// remove invalid characters
var regex = new Regex( @"[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Nl}\p{Mn}\p{Mc}\p{Cf}\p{Pc}\p{Lm}]" );
className = regex.Replace( className, "" );

// class name doesn't begin with a letter, insert an underscore
if( !char.IsLetter( className, 0 ) )
className = className.Insert( 0, "_" );

return className.Replace( " ", string.Empty );
}
#>
28 changes: 24 additions & 4 deletions MazeGame/Content/Content.mgcb
Expand Up @@ -10,15 +10,16 @@

#-------------------------------- References --------------------------------#

/reference:..\..\Tools\MonoGame.Extended.Content.Pipeline_1.1.0\MonoGame.Extended.Content.Pipeline.dll

#---------------------------------- Content ---------------------------------#

#begin fonts/Cinzel_Decorative.spritefont
#begin fonts/CinzelDecorative.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:fonts/Cinzel_Decorative.spritefont
/build:fonts/CinzelDecorative.spritefont

#begin fonts/Dynalight.spritefont
/importer:FontDescriptionImporter
Expand All @@ -27,7 +28,21 @@
/processorParam:TextureFormat=Compressed
/build:fonts/Dynalight.spritefont

#begin gfx/base_out_atlas.png
#begin fonts/NothingYouCouldDo.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:fonts/NothingYouCouldDo.spritefont

#begin fonts/OpenSansCondensed.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:PremultiplyAlpha=True
/processorParam:TextureFormat=Compressed
/build:fonts/OpenSansCondensed.spritefont

#begin gfx/misc_atlas.png
/importer:TextureImporter
/processor:TextureProcessor
/processorParam:ColorKeyColor=255,0,255,255
Expand All @@ -37,7 +52,7 @@
/processorParam:ResizeToPowerOfTwo=False
/processorParam:MakeSquare=False
/processorParam:TextureFormat=Color
/build:gfx/base_out_atlas.png
/build:gfx/misc_atlas.png

#begin gfx/slash/BEHIND_quiver.png
/importer:TextureImporter
Expand Down Expand Up @@ -1071,3 +1086,8 @@
/processorParam:TextureFormat=Color
/build:gfx/walkcycle/WEAPON_shield_cutout_chain_armor_helmet.png

#begin levels/town.tmx
/importer:TiledMapImporter
/processor:TiledMapProcessor
/build:levels/town.tmx

0 comments on commit f256499

Please sign in to comment.