diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.sln b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.sln new file mode 100644 index 000000000..8df47dc5b --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34607.119 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FlatRedBallAndroidMonoGameTemplate", "FlatRedBallAndroidMonoGameTemplate\FlatRedBallAndroidMonoGameTemplate.csproj", "{8FE4C15A-C3DA-4F99-A165-DBAFA07D7C29}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8FE4C15A-C3DA-4F99-A165-DBAFA07D7C29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FE4C15A-C3DA-4F99-A165-DBAFA07D7C29}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FE4C15A-C3DA-4F99-A165-DBAFA07D7C29}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FE4C15A-C3DA-4F99-A165-DBAFA07D7C29}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8D8B22DE-4952-47C6-85CB-1076D0A7A912} + EndGlobalSection +EndGlobal diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/.config/dotnet-tools.json b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/.config/dotnet-tools.json new file mode 100644 index 000000000..efabe22ef --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/.config/dotnet-tools.json @@ -0,0 +1,36 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-mgcb": { + "version": "3.8.1.303", + "commands": [ + "mgcb" + ] + }, + "dotnet-mgcb-editor": { + "version": "3.8.1.303", + "commands": [ + "mgcb-editor" + ] + }, + "dotnet-mgcb-editor-linux": { + "version": "3.8.1.303", + "commands": [ + "mgcb-editor-linux" + ] + }, + "dotnet-mgcb-editor-windows": { + "version": "3.8.1.303", + "commands": [ + "mgcb-editor-windows" + ] + }, + "dotnet-mgcb-editor-mac": { + "version": "3.8.1.303", + "commands": [ + "mgcb-editor-mac" + ] + } + } +} \ No newline at end of file diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Activity1.cs b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Activity1.cs new file mode 100644 index 000000000..b11154c60 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Activity1.cs @@ -0,0 +1,34 @@ +using Android.App; +using Android.Content.PM; +using Android.OS; +using Android.Views; +using Microsoft.Xna.Framework; + +namespace FlatRedBallAndroidMonoGameTemplate +{ + [Activity( + Label = "@string/app_name", + MainLauncher = true, + Icon = "@drawable/icon", + AlwaysRetainTaskState = true, + LaunchMode = LaunchMode.SingleInstance, + ScreenOrientation = ScreenOrientation.FullUser, + ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize + )] + public class Activity1 : AndroidGameActivity + { + private Game1 _game; + private View _view; + + protected override void OnCreate(Bundle bundle) + { + base.OnCreate(bundle); + + _game = new Game1(); + _view = _game.Services.GetService(typeof(View)) as View; + + SetContentView(_view); + _game.Run(); + } + } +} diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/AndroidManifest.xml b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/AndroidManifest.xml new file mode 100644 index 000000000..8dc57cfc2 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/AndroidManifest.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Content.mgcb b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Content.mgcb new file mode 100644 index 000000000..895694b66 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Content.mgcb @@ -0,0 +1,15 @@ + +#----------------------------- Global Properties ----------------------------# + +/outputDir:bin/$(Platform) +/intermediateDir:obj/$(Platform) +/platform:Android +/config: +/profile:Reach +/compress:False + +#-------------------------------- References --------------------------------# + + +#---------------------------------- Content ---------------------------------# + diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.fx b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.fx new file mode 100644 index 000000000..d582a4d19 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.fx @@ -0,0 +1,806 @@ +float4x4 ViewProj : VIEWPROJ; // World, view and projection matrix +uniform extern texture CurrentTexture; + +sampler linearTextureSampler = sampler_state +{ + Texture = ; + MipFilter = Linear; + MinFilter = Linear; + MagFilter = Linear; +}; + +sampler pointTextureSampler = sampler_state +{ + Texture = ; + MipFilter = Point; + MinFilter = Point; + MagFilter = Point; +}; + +float4 ColorModifier = float4(1.0, 1.0, 1.0, 1.0); // Color for non-vertex color rendering + +// Application to vertex structure +struct a2v +{ + float4 position : POSITION0; + float4 color : COLOR0; + float4 texCoord : TEXCOORD0; + +}; + +// Vertex to pixel processing structure +struct v2p +{ + float4 position : POSITION0; + float4 color : COLOR0; + float4 texCoord : TEXCOORD0; +}; + +// VERTEX SHADER +void vs(in a2v IN, out v2p OUT) +{ + // Transforming our position from object space to screen space + OUT.position = mul(IN.position, ViewProj); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; +} + + +float4 Linearize(float4 color) +{ + return float4(pow(color.rgb, 2.2), color.a); +} + +#define SAMPLE(textureSampler, a2v) tex2D(textureSampler, a2v.texCoord.xy) +#define SAMPLE_LINEARIZE(textureSampler, a2v) Linearize(tex2D(textureSampler, a2v.texCoord.xy)) + +#define TECHNIQUE(name, psname) \ + technique name { pass { VertexShader = compile vs_1_1 vs(); PixelShader = compile ps_2_0 psname(); } } + +float4 PremultiplyAlpha(float4 textureColor, float4 color) +{ + return textureColor *= color.a; +} + +float4 Add(float4 textureColor, float4 color) +{ + textureColor.rgb += color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Subtract(float4 textureColor, float4 color) +{ + textureColor.rgb -= color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate(float4 textureColor, float4 color) +{ + textureColor.rgb *= color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate2X(float4 textureColor, float4 color) +{ + textureColor.rgb *= 2 * color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate4X(float4 textureColor, float4 color) +{ + textureColor.rgb *= 4 * color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Inverse(float4 textureColor, float4 color) +{ + textureColor.rgb = 1 - textureColor.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 ColorTextureAlpha(float textureAlpha, float4 color) +{ + float4 returnColor = color; + returnColor.rgb *= color.a; + returnColor *= textureAlpha; + return returnColor; +} + +float4 InterpolateColor(float4 textureColor, float4 color) +{ + float4 returnColor = color; + returnColor = (textureColor * returnColor.a) + (1 - returnColor.a) * (returnColor); + returnColor.a = textureColor.a; + return returnColor; +} + + +// PIXEL SHADERS: + +// Point filtering + +float4 TexturePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorPixelShader(a2v IN) : COLOR +{ + clip(IN.color.a - .001); + return IN.color; +} + +float4 ColorTextureAlphaPixelShader_Point(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(pointTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(pointTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorPixelShader_CM(a2v IN) : COLOR +{ + clip(ColorModifier.a - .001); + return ColorModifier; +} + +float4 ColorTextureAlphaPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(pointTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(pointTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(pointTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(pointTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(pointTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(pointTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +// Linear filtering + +float4 TexturePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(linearTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(linearTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(linearTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(linearTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(linearTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(linearTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(linearTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(linearTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +// TECHNIQUES: + +// Point filtering +TECHNIQUE(Texture_Point, TexturePixelShader_Point); +TECHNIQUE(Add_Point, AddPixelShader_Point); +TECHNIQUE(Subtract_Point, SubtractPixelShader_Point); +TECHNIQUE(Modulate_Point, ModulatePixelShader_Point); +TECHNIQUE(Modulate2X_Point, Modulate2XPixelShader_Point); +TECHNIQUE(Modulate4X_Point, Modulate4XPixelShader_Point); +TECHNIQUE(InverseTexture_Point, InversePixelShader_Point); +TECHNIQUE(Color_Point, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Point, ColorTextureAlphaPixelShader_Point); +TECHNIQUE(InterpolateColor_Point, InterpolateColorPixelShader_Point); + +// Point filtering, use color modifier +TECHNIQUE(Texture_Point_CM, TexturePixelShader_Point_CM); +TECHNIQUE(Add_Point_CM, AddPixelShader_Point_CM); +TECHNIQUE(Subtract_Point_CM, SubtractPixelShader_Point_CM); +TECHNIQUE(Modulate_Point_CM, ModulatePixelShader_Point_CM); +TECHNIQUE(Modulate2X_Point_CM, Modulate2XPixelShader_Point_CM); +TECHNIQUE(Modulate4X_Point_CM, Modulate4XPixelShader_Point_CM); +TECHNIQUE(InverseTexture_Point_CM, InversePixelShader_Point_CM); +TECHNIQUE(Color_Point_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Point_CM, ColorTextureAlphaPixelShader_Point_CM); +TECHNIQUE(InterpolateColor_Point_CM, InterpolateColorPixelShader_Point_CM); + +// Point filtering, linearize texture sampling +TECHNIQUE(Texture_Point_LN, TexturePixelShader_Point_LN); +TECHNIQUE(Add_Point_LN, AddPixelShader_Point_LN); +TECHNIQUE(Subtract_Point_LN, SubtractPixelShader_Point_LN); +TECHNIQUE(Modulate_Point_LN, ModulatePixelShader_Point_LN); +TECHNIQUE(Modulate2X_Point_LN, Modulate2XPixelShader_Point_LN); +TECHNIQUE(Modulate4X_Point_LN, Modulate4XPixelShader_Point_LN); +TECHNIQUE(InverseTexture_Point_LN, InversePixelShader_Point_LN); +TECHNIQUE(Color_Point_LN, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Point_LN, ColorTextureAlphaPixelShader_Point_LN); +TECHNIQUE(InterpolateColor_Point_LN, InterpolateColorPixelShader_Point_LN); + +// Point filtering, linearize texture sampling, use color modifier +TECHNIQUE(Texture_Point_LN_CM, TexturePixelShader_Point_LN_CM); +TECHNIQUE(Add_Point_LN_CM, AddPixelShader_Point_LN_CM); +TECHNIQUE(Subtract_Point_LN_CM, SubtractPixelShader_Point_LN_CM); +TECHNIQUE(Modulate_Point_LN_CM, ModulatePixelShader_Point_LN_CM); +TECHNIQUE(Modulate2X_Point_LN_CM, Modulate2XPixelShader_Point_LN_CM); +TECHNIQUE(Modulate4X_Point_LN_CM, Modulate4XPixelShader_Point_LN_CM); +TECHNIQUE(InverseTexture_Point_LN_CM, InversePixelShader_Point_LN_CM); +TECHNIQUE(Color_Point_LN_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Point_LN_CM, ColorTextureAlphaPixelShader_Point_LN_CM); +TECHNIQUE(InterpolateColor_Point_LN_CM, InterpolateColorPixelShader_Point_LN_CM); + +// Linear filtering +TECHNIQUE(Texture_Linear, TexturePixelShader_Linear); +TECHNIQUE(Add_Linear, AddPixelShader_Linear); +TECHNIQUE(Subtract_Linear, SubtractPixelShader_Linear); +TECHNIQUE(Modulate_Linear, ModulatePixelShader_Linear); +TECHNIQUE(Modulate2X_Linear, Modulate2XPixelShader_Linear); +TECHNIQUE(Modulate4X_Linear, Modulate4XPixelShader_Linear); +TECHNIQUE(InverseTexture_Linear, InversePixelShader_Linear); +TECHNIQUE(Color_Linear, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Linear, ColorTextureAlphaPixelShader_Linear); +TECHNIQUE(InterpolateColor_Linear, InterpolateColorPixelShader_Linear); + +// Linear filtering, use color modifier +TECHNIQUE(Texture_Linear_CM, TexturePixelShader_Linear_CM); +TECHNIQUE(Add_Linear_CM, AddPixelShader_Linear_CM); +TECHNIQUE(Subtract_Linear_CM, SubtractPixelShader_Linear_CM); +TECHNIQUE(Modulate_Linear_CM, ModulatePixelShader_Linear_CM); +TECHNIQUE(Modulate2X_Linear_CM, Modulate2XPixelShader_Linear_CM); +TECHNIQUE(Modulate4X_Linear_CM, Modulate4XPixelShader_Linear_CM); +TECHNIQUE(InverseTexture_Linear_CM, InversePixelShader_Linear_CM); +TECHNIQUE(Color_Linear_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Linear_CM, ColorTextureAlphaPixelShader_Linear_CM); +TECHNIQUE(InterpolateColor_Linear_CM, InterpolateColorPixelShader_Linear_CM); + +// Linear filtering, linearize texture sampling +TECHNIQUE(Texture_Linear_LN, TexturePixelShader_Linear_LN); +TECHNIQUE(Add_Linear_LN, AddPixelShader_Linear_LN); +TECHNIQUE(Subtract_Linear_LN, SubtractPixelShader_Linear_LN); +TECHNIQUE(Modulate_Linear_LN, ModulatePixelShader_Linear_LN); +TECHNIQUE(Modulate2X_Linear_LN, Modulate2XPixelShader_Linear_LN); +TECHNIQUE(Modulate4X_Linear_LN, Modulate4XPixelShader_Linear_LN); +TECHNIQUE(InverseTexture_Linear_LN, InversePixelShader_Linear_LN); +TECHNIQUE(Color_Linear_LN, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Linear_LN, ColorTextureAlphaPixelShader_Linear_LN); +TECHNIQUE(InterpolateColor_Linear_LN, InterpolateColorPixelShader_Linear_LN); + +// Linear filtering, linearize texture sampling, use color modifier +TECHNIQUE(Texture_Linear_LN_CM, TexturePixelShader_Linear_LN_CM); +TECHNIQUE(Add_Linear_LN_CM, AddPixelShader_Linear_LN_CM); +TECHNIQUE(Subtract_Linear_LN_CM, SubtractPixelShader_Linear_LN_CM); +TECHNIQUE(Modulate_Linear_LN_CM, ModulatePixelShader_Linear_LN_CM); +TECHNIQUE(Modulate2X_Linear_LN_CM, Modulate2XPixelShader_Linear_LN_CM); +TECHNIQUE(Modulate4X_Linear_LN_CM, Modulate4XPixelShader_Linear_LN_CM); +TECHNIQUE(InverseTexture_Linear_LN_CM, InversePixelShader_Linear_LN_CM); +TECHNIQUE(Color_Linear_LN_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Linear_LN_CM, ColorTextureAlphaPixelShader_Linear_LN_CM); +TECHNIQUE(InterpolateColor_Linear_LN_CM, InterpolateColorPixelShader_Linear_LN_CM); \ No newline at end of file diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.xnb b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.xnb new file mode 100644 index 000000000..584e80d0a Binary files /dev/null and b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Content/Shader.xnb differ diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.csproj b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.csproj new file mode 100644 index 000000000..da1ae89a9 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate.csproj @@ -0,0 +1,26 @@ + + + net8.0-android + 23 + Exe + com.companyname.FlatRedBallAndroidMonoGameTemplate + 1 + 1.0 + + + + + + + + + + + Libraries\Android\Debug\FlatRedBallAndroid.dll + + + + + + + \ No newline at end of file diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Game1.cs b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Game1.cs new file mode 100644 index 000000000..6b0f5d40b --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Game1.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +using FlatRedBall; +using FlatRedBall.Graphics; +using FlatRedBall.Screens; +using Microsoft.Xna.Framework; + +using System.Linq; + +using Microsoft.Xna.Framework.Graphics; +using Microsoft.Xna.Framework.Input; + +namespace FlatRedBallAndroidMonoGameTemplate +{ + public partial class Game1 : Microsoft.Xna.Framework.Game + { + GraphicsDeviceManager graphics; + + + partial void GeneratedInitializeEarly(); + partial void GeneratedInitialize(); + partial void GeneratedUpdate(Microsoft.Xna.Framework.GameTime gameTime); + partial void GeneratedDrawEarly(Microsoft.Xna.Framework.GameTime gameTime); + partial void GeneratedDraw(Microsoft.Xna.Framework.GameTime gameTime); + + public Game1() : base() + { + graphics = new GraphicsDeviceManager(this); + +#if WINDOWS_PHONE || ANDROID || IOS + + // Frame rate is 30 fps by default for Windows Phone, + // so let's keep that for other phones too + TargetElapsedTime = TimeSpan.FromTicks(333333); + graphics.IsFullScreen = true; +#elif WINDOWS || DESKTOP_GL + graphics.PreferredBackBufferWidth = 800; + graphics.PreferredBackBufferHeight = 600; +#endif + + +#if WINDOWS_8 + FlatRedBall.Instructions.Reflection.PropertyValuePair.TopLevelAssembly = + this.GetType().GetTypeInfo().Assembly; +#endif + + } + + protected override void Initialize() + { + #if IOS + var bounds = UIKit.UIScreen.MainScreen.Bounds; + var nativeScale = UIKit.UIScreen.MainScreen.Scale; + var screenWidth = (int)(bounds.Width * nativeScale); + var screenHeight = (int)(bounds.Height * nativeScale); + graphics.PreferredBackBufferWidth = screenWidth; + graphics.PreferredBackBufferHeight = screenHeight; + #endif + + GeneratedInitializeEarly(); + + FlatRedBallServices.InitializeFlatRedBall(this, graphics); + + GeneratedInitialize(); + + base.Initialize(); + } + + protected override void Update(GameTime gameTime) + { + FlatRedBallServices.Update(gameTime); + + FlatRedBall.Screens.ScreenManager.Activity(); + + GeneratedUpdate(gameTime); + + base.Update(gameTime); + } + + protected override void Draw(GameTime gameTime) + { + GeneratedDrawEarly(gameTime); + + FlatRedBallServices.Draw(); + + GeneratedDraw(gameTime); + + base.Draw(gameTime); + } + } +} diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.dll b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.dll new file mode 100644 index 000000000..55b41dc23 Binary files /dev/null and b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.dll differ diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.pdb b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.pdb new file mode 100644 index 000000000..0ecf40a31 Binary files /dev/null and b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Libraries/Android/Debug/FlatRedBallAndroid.pdb differ diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Drawable/Icon.png b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Drawable/Icon.png new file mode 100644 index 000000000..25fe04448 Binary files /dev/null and b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Drawable/Icon.png differ diff --git a/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Values/Strings.xml b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Values/Strings.xml new file mode 100644 index 000000000..218c72753 --- /dev/null +++ b/Templates/FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Resources/Values/Strings.xml @@ -0,0 +1,4 @@ + + + FlatRedBallAndroidMonoGameTemplate + diff --git a/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Content/Shader.fx b/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Content/Shader.fx new file mode 100644 index 000000000..d582a4d19 --- /dev/null +++ b/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Content/Shader.fx @@ -0,0 +1,806 @@ +float4x4 ViewProj : VIEWPROJ; // World, view and projection matrix +uniform extern texture CurrentTexture; + +sampler linearTextureSampler = sampler_state +{ + Texture = ; + MipFilter = Linear; + MinFilter = Linear; + MagFilter = Linear; +}; + +sampler pointTextureSampler = sampler_state +{ + Texture = ; + MipFilter = Point; + MinFilter = Point; + MagFilter = Point; +}; + +float4 ColorModifier = float4(1.0, 1.0, 1.0, 1.0); // Color for non-vertex color rendering + +// Application to vertex structure +struct a2v +{ + float4 position : POSITION0; + float4 color : COLOR0; + float4 texCoord : TEXCOORD0; + +}; + +// Vertex to pixel processing structure +struct v2p +{ + float4 position : POSITION0; + float4 color : COLOR0; + float4 texCoord : TEXCOORD0; +}; + +// VERTEX SHADER +void vs(in a2v IN, out v2p OUT) +{ + // Transforming our position from object space to screen space + OUT.position = mul(IN.position, ViewProj); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; +} + + +float4 Linearize(float4 color) +{ + return float4(pow(color.rgb, 2.2), color.a); +} + +#define SAMPLE(textureSampler, a2v) tex2D(textureSampler, a2v.texCoord.xy) +#define SAMPLE_LINEARIZE(textureSampler, a2v) Linearize(tex2D(textureSampler, a2v.texCoord.xy)) + +#define TECHNIQUE(name, psname) \ + technique name { pass { VertexShader = compile vs_1_1 vs(); PixelShader = compile ps_2_0 psname(); } } + +float4 PremultiplyAlpha(float4 textureColor, float4 color) +{ + return textureColor *= color.a; +} + +float4 Add(float4 textureColor, float4 color) +{ + textureColor.rgb += color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Subtract(float4 textureColor, float4 color) +{ + textureColor.rgb -= color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate(float4 textureColor, float4 color) +{ + textureColor.rgb *= color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate2X(float4 textureColor, float4 color) +{ + textureColor.rgb *= 2 * color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Modulate4X(float4 textureColor, float4 color) +{ + textureColor.rgb *= 4 * color.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 Inverse(float4 textureColor, float4 color) +{ + textureColor.rgb = 1 - textureColor.rgb; + textureColor *= color.a; + return textureColor; +} + +float4 ColorTextureAlpha(float textureAlpha, float4 color) +{ + float4 returnColor = color; + returnColor.rgb *= color.a; + returnColor *= textureAlpha; + return returnColor; +} + +float4 InterpolateColor(float4 textureColor, float4 color) +{ + float4 returnColor = color; + returnColor = (textureColor * returnColor.a) + (1 - returnColor.a) * (returnColor); + returnColor.a = textureColor.a; + return returnColor; +} + + +// PIXEL SHADERS: + +// Point filtering + +float4 TexturePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorPixelShader(a2v IN) : COLOR +{ + clip(IN.color.a - .001); + return IN.color; +} + +float4 ColorTextureAlphaPixelShader_Point(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(pointTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(pointTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(pointTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorPixelShader_CM(a2v IN) : COLOR +{ + clip(ColorModifier.a - .001); + return ColorModifier; +} + +float4 ColorTextureAlphaPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(pointTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(pointTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(pointTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_LN(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(pointTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(pointTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(pointTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Point_LN_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(pointTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +// Linear filtering + +float4 TexturePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(linearTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(linearTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE(linearTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE(linearTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE(linearTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Add(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Subtract(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate2X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate4X(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Inverse(color, IN.color); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(linearTextureSampler, IN).a, IN.color); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_LN(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(linearTextureSampler, IN), IN.color); + clip(color.a - .001); + return color; +} + + +float4 TexturePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = PremultiplyAlpha(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 AddPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Add(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 SubtractPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Subtract(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ModulatePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate2XPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate2X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 Modulate4XPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Modulate4X(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InversePixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = SAMPLE_LINEARIZE(linearTextureSampler, IN); + color = Inverse(color, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 ColorTextureAlphaPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = ColorTextureAlpha(SAMPLE_LINEARIZE(linearTextureSampler, IN).a, ColorModifier); + clip(color.a - .001); + return color; +} + +float4 InterpolateColorPixelShader_Linear_LN_CM(a2v IN) : COLOR +{ + float4 color = InterpolateColor(SAMPLE_LINEARIZE(linearTextureSampler, IN), ColorModifier); + clip(color.a - .001); + return color; +} + + +// TECHNIQUES: + +// Point filtering +TECHNIQUE(Texture_Point, TexturePixelShader_Point); +TECHNIQUE(Add_Point, AddPixelShader_Point); +TECHNIQUE(Subtract_Point, SubtractPixelShader_Point); +TECHNIQUE(Modulate_Point, ModulatePixelShader_Point); +TECHNIQUE(Modulate2X_Point, Modulate2XPixelShader_Point); +TECHNIQUE(Modulate4X_Point, Modulate4XPixelShader_Point); +TECHNIQUE(InverseTexture_Point, InversePixelShader_Point); +TECHNIQUE(Color_Point, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Point, ColorTextureAlphaPixelShader_Point); +TECHNIQUE(InterpolateColor_Point, InterpolateColorPixelShader_Point); + +// Point filtering, use color modifier +TECHNIQUE(Texture_Point_CM, TexturePixelShader_Point_CM); +TECHNIQUE(Add_Point_CM, AddPixelShader_Point_CM); +TECHNIQUE(Subtract_Point_CM, SubtractPixelShader_Point_CM); +TECHNIQUE(Modulate_Point_CM, ModulatePixelShader_Point_CM); +TECHNIQUE(Modulate2X_Point_CM, Modulate2XPixelShader_Point_CM); +TECHNIQUE(Modulate4X_Point_CM, Modulate4XPixelShader_Point_CM); +TECHNIQUE(InverseTexture_Point_CM, InversePixelShader_Point_CM); +TECHNIQUE(Color_Point_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Point_CM, ColorTextureAlphaPixelShader_Point_CM); +TECHNIQUE(InterpolateColor_Point_CM, InterpolateColorPixelShader_Point_CM); + +// Point filtering, linearize texture sampling +TECHNIQUE(Texture_Point_LN, TexturePixelShader_Point_LN); +TECHNIQUE(Add_Point_LN, AddPixelShader_Point_LN); +TECHNIQUE(Subtract_Point_LN, SubtractPixelShader_Point_LN); +TECHNIQUE(Modulate_Point_LN, ModulatePixelShader_Point_LN); +TECHNIQUE(Modulate2X_Point_LN, Modulate2XPixelShader_Point_LN); +TECHNIQUE(Modulate4X_Point_LN, Modulate4XPixelShader_Point_LN); +TECHNIQUE(InverseTexture_Point_LN, InversePixelShader_Point_LN); +TECHNIQUE(Color_Point_LN, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Point_LN, ColorTextureAlphaPixelShader_Point_LN); +TECHNIQUE(InterpolateColor_Point_LN, InterpolateColorPixelShader_Point_LN); + +// Point filtering, linearize texture sampling, use color modifier +TECHNIQUE(Texture_Point_LN_CM, TexturePixelShader_Point_LN_CM); +TECHNIQUE(Add_Point_LN_CM, AddPixelShader_Point_LN_CM); +TECHNIQUE(Subtract_Point_LN_CM, SubtractPixelShader_Point_LN_CM); +TECHNIQUE(Modulate_Point_LN_CM, ModulatePixelShader_Point_LN_CM); +TECHNIQUE(Modulate2X_Point_LN_CM, Modulate2XPixelShader_Point_LN_CM); +TECHNIQUE(Modulate4X_Point_LN_CM, Modulate4XPixelShader_Point_LN_CM); +TECHNIQUE(InverseTexture_Point_LN_CM, InversePixelShader_Point_LN_CM); +TECHNIQUE(Color_Point_LN_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Point_LN_CM, ColorTextureAlphaPixelShader_Point_LN_CM); +TECHNIQUE(InterpolateColor_Point_LN_CM, InterpolateColorPixelShader_Point_LN_CM); + +// Linear filtering +TECHNIQUE(Texture_Linear, TexturePixelShader_Linear); +TECHNIQUE(Add_Linear, AddPixelShader_Linear); +TECHNIQUE(Subtract_Linear, SubtractPixelShader_Linear); +TECHNIQUE(Modulate_Linear, ModulatePixelShader_Linear); +TECHNIQUE(Modulate2X_Linear, Modulate2XPixelShader_Linear); +TECHNIQUE(Modulate4X_Linear, Modulate4XPixelShader_Linear); +TECHNIQUE(InverseTexture_Linear, InversePixelShader_Linear); +TECHNIQUE(Color_Linear, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Linear, ColorTextureAlphaPixelShader_Linear); +TECHNIQUE(InterpolateColor_Linear, InterpolateColorPixelShader_Linear); + +// Linear filtering, use color modifier +TECHNIQUE(Texture_Linear_CM, TexturePixelShader_Linear_CM); +TECHNIQUE(Add_Linear_CM, AddPixelShader_Linear_CM); +TECHNIQUE(Subtract_Linear_CM, SubtractPixelShader_Linear_CM); +TECHNIQUE(Modulate_Linear_CM, ModulatePixelShader_Linear_CM); +TECHNIQUE(Modulate2X_Linear_CM, Modulate2XPixelShader_Linear_CM); +TECHNIQUE(Modulate4X_Linear_CM, Modulate4XPixelShader_Linear_CM); +TECHNIQUE(InverseTexture_Linear_CM, InversePixelShader_Linear_CM); +TECHNIQUE(Color_Linear_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Linear_CM, ColorTextureAlphaPixelShader_Linear_CM); +TECHNIQUE(InterpolateColor_Linear_CM, InterpolateColorPixelShader_Linear_CM); + +// Linear filtering, linearize texture sampling +TECHNIQUE(Texture_Linear_LN, TexturePixelShader_Linear_LN); +TECHNIQUE(Add_Linear_LN, AddPixelShader_Linear_LN); +TECHNIQUE(Subtract_Linear_LN, SubtractPixelShader_Linear_LN); +TECHNIQUE(Modulate_Linear_LN, ModulatePixelShader_Linear_LN); +TECHNIQUE(Modulate2X_Linear_LN, Modulate2XPixelShader_Linear_LN); +TECHNIQUE(Modulate4X_Linear_LN, Modulate4XPixelShader_Linear_LN); +TECHNIQUE(InverseTexture_Linear_LN, InversePixelShader_Linear_LN); +TECHNIQUE(Color_Linear_LN, ColorPixelShader); +TECHNIQUE(ColorTextureAlpha_Linear_LN, ColorTextureAlphaPixelShader_Linear_LN); +TECHNIQUE(InterpolateColor_Linear_LN, InterpolateColorPixelShader_Linear_LN); + +// Linear filtering, linearize texture sampling, use color modifier +TECHNIQUE(Texture_Linear_LN_CM, TexturePixelShader_Linear_LN_CM); +TECHNIQUE(Add_Linear_LN_CM, AddPixelShader_Linear_LN_CM); +TECHNIQUE(Subtract_Linear_LN_CM, SubtractPixelShader_Linear_LN_CM); +TECHNIQUE(Modulate_Linear_LN_CM, ModulatePixelShader_Linear_LN_CM); +TECHNIQUE(Modulate2X_Linear_LN_CM, Modulate2XPixelShader_Linear_LN_CM); +TECHNIQUE(Modulate4X_Linear_LN_CM, Modulate4XPixelShader_Linear_LN_CM); +TECHNIQUE(InverseTexture_Linear_LN_CM, InversePixelShader_Linear_LN_CM); +TECHNIQUE(Color_Linear_LN_CM, ColorPixelShader_CM); +TECHNIQUE(ColorTextureAlpha_Linear_LN_CM, ColorTextureAlphaPixelShader_Linear_LN_CM); +TECHNIQUE(InterpolateColor_Linear_LN_CM, InterpolateColorPixelShader_Linear_LN_CM); \ No newline at end of file diff --git a/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Game1.cs b/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Game1.cs index 2ada2ad23..a38a078bc 100644 --- a/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Game1.cs +++ b/Templates/FlatRedBalliOSMonoGameTemplate/FlatRedBalliOSMonoGameTemplate/Game1.cs @@ -11,7 +11,6 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; -using FlatRedBall.Math.Geometry; namespace FlatRedBalliOSMonoGameTemplate { diff --git a/Templates/Game1Copier.exe b/Templates/Game1Copier.exe index 58efe3a22..7eef09aa5 100644 Binary files a/Templates/Game1Copier.exe and b/Templates/Game1Copier.exe differ diff --git a/Templates/Game1Copier/Game1Copier/Program.cs b/Templates/Game1Copier/Game1Copier/Program.cs index 28381abee..af64d1589 100644 --- a/Templates/Game1Copier/Game1Copier/Program.cs +++ b/Templates/Game1Copier/Game1Copier/Program.cs @@ -14,10 +14,6 @@ class Program { static List templates = new List { - new TemplateInformation { - DestinationGameFile = "FlatRedBallAndroidTemplate/FlatRedBallAndroidTemplate/Game1.cs", - Namespace = "FlatRedBallAndroidTemplate" - }, new TemplateInformation { DestinationGameFile = "FlatRedBallDesktopGLTemplate/FlatRedBallDesktopGLTemplate/Game1.cs", Namespace = "FlatRedBallDesktopGlTemplate" @@ -39,8 +35,8 @@ class Program Namespace = "FlatRedBallXna4Template" }, new TemplateInformation { - DestinationGameFile = "Windows8Template/Windows8Template/Game1.cs", - Namespace = "Windows8Template" + DestinationGameFile = "FlatRedBallAndroidMonoGameTemplate/FlatRedBallAndroidMonoGameTemplate/Game1.cs", + Namespace = "FlatRedBallAndroidMonoGameTemplate" }, }; static void Main(string[] args)