Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: CartBlanche/MonoGame
...
head fork: CartBlanche/MonoGame
Checking mergeability… Don't worry, you can still create the pull request.
  • 3 commits
  • 2 files changed
  • 0 commit comments
  • 2 contributors
View
22 ...plates/MonoDevelop.MonoGame.2.5/MonoDevelop.MonoGame/MonoDevelop.MonoGame/MonoDevelop.MonoGame.addin.xml
@@ -27,6 +27,26 @@
<Extension path = "/MonoDevelop/Core/StockIcons">
<StockIcon stockid = "monogame-project" file = "icons/monogame-project-32.png" />
</Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/MSBuildItemTypes">
+ <DotNetProjectSubtype id="MonoGame"
+ guid="{9b831fef-f496-498f-9fe8-180da5cb4258}"
+ type="MonoDevelop.MonoGame.MonoGameProject">
+ </DotNetProjectSubtype>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/Core/MimeTypes">
+ <MimeType id="application/fx" _description="XNA 4.0 Effect File" isText="true">
+ <File pattern="*.fx" />
+ </MimeType>
+ <MimeType id="application/mgfx" _description="MonoGame Effect File" isText="true">
+ <File pattern="*.mgfx" />
+ </MimeType>
+ </Extension>
+
+ <Extension path = "/MonoDevelop/ProjectModel/ProjectServiceExtensions">
+ <Class class = "MonoDevelop.MonoGame.MonoGameBuildExtension" insertafter="FinalStep" />
+ </Extension>
<Extension path = "/MonoDevelop/ProjectModel/ProjectBindings">
<ProjectBinding id = "MonoGame" class = "MonoDevelop.MonoGame.MonoGameProjectBinding" />
@@ -37,6 +57,8 @@
<ProjectTemplate id = "MonoGameForWindowsProject" file = "templates/MonoGameWindowsProject.xpt.xml"/>
<ProjectTemplate id = "MonoGameForLinuxProject" file = "templates/MonoGameLinuxProject.xpt.xml"/>
</Extension>
+
+
</Addin>
View
111 ProjectTemplates/MonoDevelop.MonoGame.2.5/MonoDevelop.MonoGame/MonoDevelop.MonoGame/MonoGameProject.cs
@@ -4,7 +4,22 @@
using MonoDevelop.Core.Assemblies;
namespace MonoDevelop.MonoGame
-{
+{
+ public static class MonoGameBuildAction
+ {
+ public static readonly string Shader;
+
+ public static bool IsMonoGameBuildAction(string action)
+ {
+ return action == Shader;
+ }
+
+ static MonoGameBuildAction ()
+ {
+ Shader = "MonoGameShader";
+ }
+ }
+
public class MonoGameProject : DotNetAssemblyProject
{
public MonoGameProject ()
@@ -52,12 +67,82 @@ public override bool SupportsFramework (MonoDevelop.Core.Assemblies.TargetFramew
else
return base.SupportsFramework (framework);
}
+
+ protected override System.Collections.Generic.IList<string> GetCommonBuildActions ()
+ {
+ var actions = new System.Collections.Generic.List<string>(base.GetCommonBuildActions());
+ actions.Add(MonoGameBuildAction.Shader);
+ return actions;
+ }
+
+ public override string GetDefaultBuildAction (string fileName)
+ {
+ if (System.IO.Path.GetExtension(fileName) == ".fx")
+ {
+ return MonoGameBuildAction.Shader;
+ }
+ return base.GetDefaultBuildAction (fileName);
+ }
+
+ }
+
+ public class MonoGameBuildExtension : ProjectServiceExtension
+ {
+
+ protected override BuildResult Build (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, ConfigurationSelector configuration)
+ {
+#if DEBUG
+ monitor.Log.WriteLine("MonoGame Extension Build Called");
+#endif
+ try
+ {
+ return base.Build (monitor, item, configuration);
+ }
+ finally
+ {
+#if DEBUG
+ monitor.Log.WriteLine("MonoGame Extension Build Ended");
+#endif
+ }
+ }
+
+ protected override BuildResult Compile (MonoDevelop.Core.IProgressMonitor monitor, SolutionEntityItem item, BuildData buildData)
+ {
+#if DEBUG
+ monitor.Log.WriteLine("MonoGame Extension Compile Called");
+#endif
+ try
+ {
+ var proj = item as MonoGameProject;
+ if (proj == null)
+ {
+ return base.Compile (monitor, item, buildData);
+ }
+ var results = new System.Collections.Generic.List<BuildResult>();
+ foreach(var file in proj.Files)
+ {
+ if (MonoGameBuildAction.IsMonoGameBuildAction(file.BuildAction))
+ {
+ buildData.Items.Add(file);
+ var buildResult = MonoGameContentProcessor.Compile(file, monitor, buildData);
+ results.Add(buildResult);
+ }
+ }
+ return base.Compile (monitor, item, buildData).Append(results);
+ }
+ finally
+ {
+#if DEBUG
+ monitor.Log.WriteLine("MonoGame Extension Compile Ended");
+#endif
+ }
+ }
}
public class MonoGameProjectBinding : IProjectBinding
{
public Project CreateProject (ProjectCreateInformation info, System.Xml.XmlElement projectOptions)
- {
+ {
string lang = projectOptions.GetAttribute ("language");
return new MonoGameProject (lang, info, projectOptions);
}
@@ -85,12 +170,32 @@ public MonoGameProjectConfiguration () : base ()
public MonoGameProjectConfiguration (string name) : base (name)
{
- }
+ }
public override void CopyFrom (ItemConfiguration configuration)
{
base.CopyFrom (configuration);
}
}
+
+ public class MonoGameContentProcessor
+ {
+
+ public static BuildResult Compile(ProjectFile file,MonoDevelop.Core.IProgressMonitor monitor,BuildData buildData)
+ {
+ switch (file.BuildAction) {
+ case "MonoGameShader" :
+ var result = new BuildResult();
+ monitor.Log.WriteLine("Compiling Shader");
+ monitor.Log.WriteLine("Shader : "+buildData.Configuration.OutputDirectory);
+ monitor.Log.WriteLine("Shader : "+file.FilePath);
+ monitor.Log.WriteLine("Shader : "+file.ToString());
+ return result;
+ default:
+ return new BuildResult();
+ }
+
+ }
+ }
}

No commit comments for this range

Something went wrong with that request. Please try again.