diff --git a/ZombustersWindows/Components/MusicComponent.cs b/ZombustersWindows/Components/MusicComponent.cs index cb36b16..8520b7d 100644 --- a/ZombustersWindows/Components/MusicComponent.cs +++ b/ZombustersWindows/Components/MusicComponent.cs @@ -109,18 +109,18 @@ protected override void LoadContent() retroTraxBkgTexture = contentManager.Load(@"InGame/GUI/retrotrax_anim_bkg"); retroTraxLogoTexture = contentManager.Load(@"InGame/GUI/retrotrax_anim"); - LoadSong("Dancing on a Dime", @"Music/BareWires_DancingOnADime"); - LoadSong("High Dive", @"Music/BlackMath_HighDive"); - LoadSong("Suck City", @"Music/BlackMath_SuckCity"); - LoadSong("Bad Attraction", @"Music/BradSucks_BadAttraction"); - LoadSong("Understood by your Dad", @"Music/BradSucks_UnderstoodByYourDad"); - LoadSong("Wolfram", @"Music/Kraus_Wolfram"); - LoadSong("High Ground", @"Music/LondonToTokyo_HighGround"); - LoadSong("Opening The Portal", @"Music/NuitNoire_OpeningThePortal"); - LoadSong("I Don't Like You", @"Music/TheBlackBug_IDontLikeYou"); - LoadSong("In The Hall Of The Mountain King", @"Music/TheItchyCreeps_ITHOTM"); - LoadSong("As You Know", @"Music/ThisCo_AsYouKnow"); - LoadSong("Take It Away", @"Music/ThisCo_TakeItAway"); + LoadSong("Dancing on a Dime", @"Music\BareWires_DancingOnADime"); + LoadSong("High Dive", @"Music\BlackMath_HighDive"); + LoadSong("Suck City", @"Music\BlackMath_SuckCity"); + LoadSong("Bad Attraction", @"Music\BradSucks_BadAttraction"); + LoadSong("Understood by your Dad", @"Music\BradSucks_UnderstoodByYourDad"); + LoadSong("Wolfram", @"Music\Kraus_Wolfram"); + LoadSong("High Ground", @"Music\LondonToTokyo_HighGround"); + LoadSong("Opening The Portal", @"Music\NuitNoire_OpeningThePortal"); + LoadSong("I Don't Like You", @"Music\TheBlackBug_IDontLikeYou"); + LoadSong("In The Hall Of The Mountain King", @"Music\TheItchyCreeps_ITHOTM"); + LoadSong("As You Know", @"Music\ThisCo_AsYouKnow"); + LoadSong("Take It Away", @"Music\ThisCo_TakeItAway"); font = contentManager.Load(@"menu\ArialMenuInfo"); fontItalic = contentManager.Load(@"menu\ArialMusic"); @@ -166,7 +166,8 @@ public void LoadSong(string songName, string songPath) throw new InvalidOperationException(string.Format("Song '{0}' has already been loaded", songName)); } - songsDictionary.Add(songName, contentManager.Load(songPath)); + //songsDictionary.Add(songName, contentManager.Load(songPath)); + //songsDictionary.Add(songName, Song.FromUri(songName, new Uri(songPath, UriKind.RelativeOrAbsolute))); } /// @@ -192,6 +193,7 @@ public void PlaySong(string song) /// True if song should loop, false otherwise public void PlaySong(string song, bool loop) { + /* string songName = song.Split('|')[0]; if (CurrentSong != songName) @@ -226,6 +228,7 @@ public void PlaySong(string song, bool loop) MediaPlayer.Pause(); } } + */ } /// diff --git a/ZombustersWindows/Content/Content.mgcb b/ZombustersWindows/Content/Content.mgcb index 312657d..67299a1 100644 --- a/ZombustersWindows/Content/Content.mgcb +++ b/ZombustersWindows/Content/Content.mgcb @@ -3,7 +3,7 @@ /outputDir:bin/Windows /intermediateDir:obj/Windows -/platform:DesktopGL +/platform:Windows /config: /profile:Reach /compress:False @@ -13,6 +13,25 @@ #---------------------------------- Content ---------------------------------# +#begin fx/BloomCombine.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/build:fx/BloomCombine.fx + +#begin fx/BloomExtract.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/processorParam:Defines= +/build:fx/BloomExtract.fx + +#begin fx/GaussianBlur.fx +/importer:EffectImporter +/processor:EffectProcessor +/processorParam:DebugMode=Auto +/build:fx/GaussianBlur.fx + #begin Music/BareWires_DancingOnADime.ogg /importer:OggImporter /processor:SongProcessor diff --git a/ZombustersWindows/Content/fx/BloomCombine.fx b/ZombustersWindows/Content/fx/BloomCombine.fx new file mode 100644 index 0000000..6617b85 --- /dev/null +++ b/ZombustersWindows/Content/fx/BloomCombine.fx @@ -0,0 +1,49 @@ +// Pixel shader combines the bloom image with the original +// scene, using tweakable intensity levels and saturation. +// This is the final step in applying a bloom post-process. +#include "Macros.fxh" + +DECLARE_TEXTURE(BloomTexture, 0); + +BEGIN_DECLARE_TEXTURE(BaseTexture, 1) +Filter = LINEAR; +AddressU = CLAMP; +AddressV = CLAMP; +END_DECLARE_TEXTURE; + +BEGIN_CONSTANTS +float BloomIntensity; +float BaseIntensity; +float BloomSaturation; +float BaseSaturation; +END_CONSTANTS + +// Helper for modifying the saturation of a color. +float4 AdjustSaturation(float4 color, float saturation) +{ + // The constants 0.3, 0.59, and 0.11 are chosen because the + // human eye is more sensitive to green light, and less to blue. + float grey = dot((float3)color, float3(0.3, 0.59, 0.11)); + + return lerp(grey, color, saturation); +} + +float4 PixelShaderFunction(float4 position : SV_POSITION, float4 Color : COLOR0, float2 texCoord : TEXCOORD0) : SV_TARGET0 +{ + // Look up the bloom and original base image colors. + float4 bloom = SAMPLE_TEXTURE(BloomTexture, texCoord); + float4 base = SAMPLE_TEXTURE(BaseTexture, texCoord); + + // Adjust color saturation and intensity. + bloom = AdjustSaturation(bloom, BloomSaturation) * BloomIntensity; + base = AdjustSaturation(base, BaseSaturation) * BaseIntensity; + + // Darken down the base image in areas where there is a lot of bloom, + // to prevent things looking excessively burned-out. + base *= (1 - saturate(bloom)); + + // Combine the two images. + return base + bloom; +} + +TECHNIQUE_NO_VS(BloomCombine, PixelShaderFunction); diff --git a/ZombustersWindows/Content/fx/BloomCombine.xnb b/ZombustersWindows/Content/fx/BloomCombine.xnb index f950d7f..9a7c729 100644 Binary files a/ZombustersWindows/Content/fx/BloomCombine.xnb and b/ZombustersWindows/Content/fx/BloomCombine.xnb differ diff --git a/ZombustersWindows/Content/fx/BloomExtract.fx b/ZombustersWindows/Content/fx/BloomExtract.fx new file mode 100644 index 0000000..e0fbef9 --- /dev/null +++ b/ZombustersWindows/Content/fx/BloomExtract.fx @@ -0,0 +1,31 @@ +// Pixel shader extracts the brighter areas of an image. +// This is the first step in applying a bloom postprocess. + +sampler TextureSampler : register(s0); + +float BloomThreshold; + + +float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0 +{ + // Look up the original image color. + float4 c = tex2D(TextureSampler, texCoord); + + // Adjust it to keep only values brighter than the specified threshold. + return saturate((c - BloomThreshold) / (1 - BloomThreshold)); +} + + +technique BloomExtract +{ + pass Pass1 + { +#if SM4 + PixelShader = compile ps_4_0_level_9_1 PixelShaderF(); +#elif SM3 + PixelShader = compile ps_3_0 PixelShaderF(); +#else + PixelShader = compile ps_2_0 PixelShaderF(); +#endif + } +} diff --git a/ZombustersWindows/Content/fx/BloomExtract.xnb b/ZombustersWindows/Content/fx/BloomExtract.xnb index b96767a..24fc4fe 100644 Binary files a/ZombustersWindows/Content/fx/BloomExtract.xnb and b/ZombustersWindows/Content/fx/BloomExtract.xnb differ diff --git a/ZombustersWindows/Content/fx/GaussianBlur.fx b/ZombustersWindows/Content/fx/GaussianBlur.fx new file mode 100644 index 0000000..0e73d07 --- /dev/null +++ b/ZombustersWindows/Content/fx/GaussianBlur.fx @@ -0,0 +1,39 @@ +// Pixel shader applies a one dimensional gaussian blur filter. +// This is used twice by the bloom postprocess, first to +// blur horizontally, and then again to blur vertically. + +sampler TextureSampler : register(s0); + +#define SAMPLE_COUNT 15 + +float2 SampleOffsets[SAMPLE_COUNT]; +float SampleWeights[SAMPLE_COUNT]; + + +float4 PixelShaderF(float2 texCoord : TEXCOORD0) : COLOR0 +{ + float4 c = 0; + + // Combine a number of weighted image filter taps. + for (int i = 0; i < SAMPLE_COUNT; i++) + { + c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i]; + } + + return c; +} + + +technique GaussianBlur +{ + pass Pass1 + { +#if SM4 + PixelShader = compile ps_4_0_level_9_1 PixelShaderF(); +#elif SM3 + PixelShader = compile ps_3_0 PixelShaderF(); +#else + PixelShader = compile ps_2_0 PixelShaderF(); +#endif + } +} diff --git a/ZombustersWindows/Content/fx/GaussianBlur.xnb b/ZombustersWindows/Content/fx/GaussianBlur.xnb index 8f4dd6c..a5758f1 100644 Binary files a/ZombustersWindows/Content/fx/GaussianBlur.xnb and b/ZombustersWindows/Content/fx/GaussianBlur.xnb differ diff --git a/ZombustersWindows/Content/fx/Macros.fxh b/ZombustersWindows/Content/fx/Macros.fxh new file mode 100644 index 0000000..9173f37 --- /dev/null +++ b/ZombustersWindows/Content/fx/Macros.fxh @@ -0,0 +1,99 @@ +//----------------------------------------------------------------------------- +// Macros.fxh +// +// Microsoft XNA Community Game Platform +// Copyright (C) Microsoft Corporation. All rights reserved. +//----------------------------------------------------------------------------- + +#ifdef SM5 + +// Macros for targeting shader 5.0(DX11) + +#define TECHNIQUE(name, vsname, psname ) \ + technique name { pass { VertexShader = compile vs_5_0 vsname (); PixelShader = compile ps_5_0 psname(); } } + +#define TECHNIQUE_NO_VS(name, psname ) \ + technique name { pass { PixelShader = compile ps_5_0 psname(); } } + +#elif SM4 + +// Macros for targeting shader model 4.0(DX11) + +#define TECHNIQUE(name, vsname, psname ) \ + technique name { pass { VertexShader = compile vs_4_0_level_9_1 vsname (); PixelShader = compile ps_4_0_level_9_1 psname(); } } + +#define TECHNIQUE_NO_VS(name, psname ) \ + technique name { pass { PixelShader = compile ps_4_0_level_9_1 psname(); } } + + +#elif OPENGL + +// Macros for targeting shader model 3.0 (OPENGL) + +#define TECHNIQUE(name, vsname, psname ) \ + technique name { pass { VertexShader = compile vs_3_0 vsname (); PixelShader = compile ps_3_0 psname(); } } + +#define TECHNIQUE_NO_VS(name, psname ) \ + technique name { pass { PixelShader = compile ps_3_0 psname(); } } + +#else + +// Macros for targeting shader model 2.0 (DX9) + +#define TECHNIQUE(name, vsname, psname ) \ + technique name { pass { VertexShader = compile vs_2_0 vsname (); PixelShader = compile ps_2_0 psname(); } } + +#define TECHNIQUE_NO_VS(name, psname ) \ + technique name { pass { PixelShader = compile ps_2_0 psname(); } } + +#endif + +#if defined(SM5) || defined(SM4) + +// Macros for targeting shader model 4.0 and 5.0(DX11) + +#define BEGIN_CONSTANTS cbuffer Parameters : register(b0) { +#define END_CONSTANTS }; + +#define DECLARE_TEXTURE(Name, index) \ + Texture2D Name : register(t##index); \ + sampler Name##Sampler : register(s##index) + +#define BEGIN_DECLARE_TEXTURE(Name, index) \ + DECLARE_TEXTURE(Name, index) \ + { + +#define END_DECLARE_TEXTURE \ + } + +#define SAMPLE_TEXTURE(Name, texCoord) Name.Sample(Name##Sampler, texCoord) + +#else + +// Macros for targeting shader model 2.0, 3.0 (DX9/OPENGL) + +#define SV_POSITION POSITION +#define SV_POSITION0 POSITION0 +#define SV_TARGET COLOR +#define SV_TARGET0 COLOR0 + +#define BEGIN_CONSTANTS +#define END_CONSTANTS + +#define DECLARE_TEXTURE(Name, index) \ + sampler Name##Sampler : register(s##index) \ + { \ + Texture = (Name); \ + } + +#define BEGIN_DECLARE_TEXTURE(Name, index) \ + sampler Name##Sampler : register(s##index) \ + { \ + Texture = (Name); + +#define END_DECLARE_TEXTURE \ + } + +#define SAMPLE_TEXTURE(Name, texCoord) tex2D(Name##Sampler, texCoord) + +#endif diff --git a/ZombustersWindows/MainScreens/LogoScreen.cs b/ZombustersWindows/MainScreens/LogoScreen.cs index feb29f6..9bac22d 100644 --- a/ZombustersWindows/MainScreens/LogoScreen.cs +++ b/ZombustersWindows/MainScreens/LogoScreen.cs @@ -65,8 +65,7 @@ public override void Update(GameTime gameTime, bool otherScreenHasFocus, bool co void FinishLogo() { this.ScreenManager.AddScreen(new StartScreen()); - //Removes the Bloom Effect from the Menu - //this.Game.bloom.Visible = !this.Game.bloom.Visible; + game.bloom.Visible = true; ExitScreen(); } diff --git a/ZombustersWindows/MenuScreens/MenuScreen.cs b/ZombustersWindows/MenuScreens/MenuScreen.cs index 69c1d1e..6fd1b91 100644 --- a/ZombustersWindows/MenuScreens/MenuScreen.cs +++ b/ZombustersWindows/MenuScreens/MenuScreen.cs @@ -39,7 +39,6 @@ public override void Initialize() { fontItalic = game.Content.Load(@"menu\ArialMusic"); fontSmallItalic = game.Content.Load(@"menu\ArialMusicItalic"); menu = new MenuComponent(game, MenuListFont); - //bloom = new BloomComponent(game); menu.Initialize(); menu.AddText("WPPlayNewGame", "WPPlayNewGameMMString"); menu.AddText("ExtrasMenuString", "ExtrasMMString"); @@ -58,7 +57,6 @@ public override void Initialize() { menu.MenuConfigSelected += new EventHandler(OnMenuConfigSelected); //menu.MenuShowMarketplace += new EventHandler(OnShowMarketplace); menu.CenterInXLeftMenu(view); - //bloom.Visible = !bloom.Visible; game.isInMenu = true; base.Initialize(); this.isBackgroundOn = true; diff --git a/ZombustersWindows/MyGame.cs b/ZombustersWindows/MyGame.cs index a94affd..e586885 100644 --- a/ZombustersWindows/MyGame.cs +++ b/ZombustersWindows/MyGame.cs @@ -38,7 +38,7 @@ public class MyGame : Game { public StorageDataSource storageDataSource; public float totalGameSeconds; - //public BloomComponent bloom; + public BloomComponent bloom; //public StorageDeviceManager storageDeviceManager; #if DEBUG @@ -46,8 +46,6 @@ public class MyGame : Game { public DebugInfoComponent DebugComponent; #endif - //int bloomSettingsIndex = 0; - public String[] networkSettings = { "XBOX LIVE", "SYSTEM LINK" }; public int currentNetworkSetting; public int maxGamers = 4; @@ -76,15 +74,14 @@ public MyGame() { audio.SetOptions(0.7f, 0.5f); input = new InputManager(this); Components.Add(input); - //Bloom Component - //REVISAR!!! - //graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0; - /* - bloom = new BloomComponent(this); + + bloom = new BloomComponent(this) + { + Settings = BloomSettings.PresetSettings[6] + }; Components.Add(bloom); - bloom.Settings = BloomSettings.PresetSettings[6]; bloom.Visible = true; - */ + bugSnagClient = new Client("1cad9818fb8d84290d776245cd1f948d"); //bugSnagClient.StartAutoNotify(); @@ -117,7 +114,7 @@ protected override void Initialize() { if (i == 0) { this.InitializeMain(PlayerIndex.One); } - } + } base.Initialize(); screenManager.AddScreen(new LogoScreen()); currentGameState = GameState.SignIn; @@ -318,6 +315,7 @@ public void FailToMenu() { public void QuitGame() { playScreen = null; + bloom.Visible = true; Reset(); bPaused = EndPause(); } diff --git a/ZombustersWindows/ZombustersWindows.csproj b/ZombustersWindows/ZombustersWindows.csproj index 1581987..2beaa5d 100644 --- a/ZombustersWindows/ZombustersWindows.csproj +++ b/ZombustersWindows/ZombustersWindows.csproj @@ -196,6 +196,10 @@ ..\packages\GameAnalytics.Mono.SDK.3.0.6\lib\net45\GameAnalytics.Mono.dll + + False + ..\..\..\..\..\..\..\Program Files (x86)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll + ..\packages\Newtonsoft.Json.6.0.1\lib\net45\Newtonsoft.Json.dll @@ -228,9 +232,6 @@ ..\packages\MonoGame.Framework.MacOS.3.6.0.1625\lib\net45\Tao.Sdl.dll - - ..\packages\MonoGame.Framework.DesktopGL.3.5.1.1679\lib\net40\MonoGame.Framework.dll - ..\packages\MonoGame.Framework.DesktopGL.3.5.1.1679\lib\net40\NVorbis.dll False @@ -405,15 +406,6 @@ PreserveNewest - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - PreserveNewest @@ -1210,6 +1202,19 @@ PreserveNewest + + + PreserveNewest + + + + PreserveNewest + + + + PreserveNewest + +