protected override void Initialize() { linerenderer = new LineRenderer((SpaceShooterGame)game); linerenderer.OnCreateDevice(); discrenderer = new DiscRenderer((SpaceShooterGame)game); discrenderer.OnCreateDevice(); sphererenderer = new SphereRenderer((SpaceShooterGame)game); sphererenderer.OnCreateDevice(); pointrenderer = new PointRenderer(Game.Content.Load <Effect>("shaders/pointeffect")); PointSpriteHelper.Initialize(); particles.Initialize(); boltManager.Initialize(); spriteBatch = new SpriteBatch(GraphicsDevice); serif = Game.Content.Load <SpriteFont>(@"fonts\serif"); serifbig = Game.Content.Load <SpriteFont>(@"fonts\serifbig"); gothic = Game.Content.Load <SpriteFont>(@"fonts\gothic"); hudsheet = FrameworkCore.content.Load <Texture2D>(@"textures\hudsheet"); eventsheet = FrameworkCore.content.Load <Texture2D>(@"textures\eventsheet"); modelDebris01 = FrameworkCore.Game.Content.Load <Model>(@"meshes\debris01"); modelDebris02 = FrameworkCore.Game.Content.Load <Model>(@"meshes\debris02"); modelAsteroid01 = FrameworkCore.Game.Content.Load <Model>(@"meshes\asteroid01"); modelAsteroid02 = FrameworkCore.Game.Content.Load <Model>(@"meshes\asteroid02"); modelBeam01 = FrameworkCore.Game.Content.Load <Model>(@"meshes\beam"); modelPlanet = FrameworkCore.Game.Content.Load <Model>(@"meshes\planet"); modelPlanetTiny = FrameworkCore.Game.Content.Load <Model>(@"meshes\planettiny"); if (modelArray == null) { int i, j = modelFiles.GetLength(0); modelArray = new Model[j]; for (i = 0; i < j; i++) { modelArray[i] = content.Load <Model>(modelFiles[i]); } } //pre load all the textures. if (textureArray == null) { int i, j = modelFiles.GetLength(0); textureArray = new Texture2D[j]; for (i = 0; i < j; i++) { textureArray[i] = ((BasicEffect)FrameworkCore.ModelArray[i].Meshes[0].MeshParts[0].Effect).Texture; } } Meshrenderer.Initialize(); playerMeshRenderer.Initialize(); meshRenderer.LoadContent(); playerMeshRenderer.LoadContent(); #if XBOX audioEngine = new AudioEngine("XboxContent/xbox/serp6.xgs"); soundBank = new SoundBank(audioEngine, "XboxContent/xbox/Sound Bank.xsb"); waveBank = new WaveBank(audioEngine, "XboxContent/xbox/Wave Bank.xwb"); #else try { audioEngine = new AudioEngine("WindowsContent\\win\\serp6.xgs"); soundBank = new SoundBank(audioEngine, "WindowsContent\\win\\Sound Bank.xsb"); waveBank = new WaveBank(audioEngine, "WindowsContent\\win\\Wave Bank.xwb"); } catch { #if SDL2 if (!YesNoPopup.Show( "Audio Error", "There was a problem initializing the audio engine.\n\nTo resolve this:\n1. Right-click on your volume control.\n2. Select \"Playback devices\"\n3. Right-click on \"Digital Output\"\n4. Select \"Set as Default Device\"\n\nDo you want to continue with sound disabled?")) #else if (MessageBox.Show( "There was a problem initializing the audio engine.\n\nTo resolve this:\n1. Right-click on your volume control.\n2. Select \"Playback devices\"\n3. Right-click on \"Digital Output\"\n4. Select \"Set as Default Device\"\n\nDo you want to continue with sound disabled?", "Audio Error", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Error) == DialogResult.No) #endif { this.Exit(); } } #endif try { SoundCategory = audioEngine.GetCategory("Default"); MusicCategory = audioEngine.GetCategory("Music"); } catch { } SetSoundVolume(); SetMusicVolume(); bloomComponent.Initialize(); base.Initialize(); }
/// <summary> /// The main entry point for the application. /// </summary> static void Main(string[] args) { #if SDL2 string baseFolder = GetStorageRoot(); string oldFolder = System.IO.Path.Combine(baseFolder, "AllPlayers"); string newFolder = System.IO.Path.Combine(baseFolder, "Flotilla", "AllPlayers"); if (System.IO.Directory.Exists(oldFolder) && !System.IO.Directory.Exists(newFolder)) { try { Console.Write("MIGRATING XNA3 SAVES TO XNA4..."); System.IO.Directory.CreateDirectory(newFolder); System.IO.File.Copy( System.IO.Path.Combine(oldFolder, "saveinfo.dat"), System.IO.Path.Combine(newFolder, "saveinfo.dat") ); System.IO.File.Copy( System.IO.Path.Combine(oldFolder, "scores.dat"), System.IO.Path.Combine(newFolder, "scores.dat") ); System.IO.File.Copy( System.IO.Path.Combine(oldFolder, "settings.xml"), System.IO.Path.Combine(newFolder, "settings.xml") ); Console.WriteLine(" COMPLETE!"); } catch { SDL2.SDL.SDL_ShowSimpleMessageBox( SDL2.SDL.SDL_MessageBoxFlags.SDL_MESSAGEBOX_ERROR, "XNA3->XNA4 Migration Failed!", "We just tried to copy your old XNA3 saves over to the new location,\n" + "but something caused it to fail. We don't know what though.\n\n" + "To migrate by hand, go to this folder...\n\n" + baseFolder + "\n\n" + "... make an extra \"Flotilla\" folder inside, then move the \"AllPlayers\"\n" + "folder inside that extra folder. Your old save data should load after that!", IntPtr.Zero ); } } #endif #if WINDOWS #if !DEBUG try { #endif using (SpaceShooterGame game = new SpaceShooterGame()) { game.Run(); } #if !DEBUG } catch (Exception e) { string userVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Major.ToString() + "." + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.Minor.ToString(); string registered = string.Empty; if (System.IO.File.Exists(@"WindowsContent/splash.bmp")) { registered = "Registered"; } else { registered = "Demo"; } string finalString = registered + " version " + userVersion + "\n\n" + e.ToString(); #if SDL2 Console.WriteLine(finalString); if (YesNoPopup.Show("Flotilla Critical Error", "Flotilla has encountered a catastrophic error:\n\n" + finalString + "\n\n\nSend this crash report to BlendoGames.com?")) { SendCrashReport(finalString); } #else if (MessageBox.Show( "Flotilla has encountered a catastrophic error:\n\n" + finalString + "\n\n\nSend this crash report to BlendoGames.com?", "Flotilla Critical Error", MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Error) == DialogResult.Yes) { SendCrashReport(finalString); } #endif } #endif #else using (SpaceShooterGame game = new SpaceShooterGame()) { game.Run(); } #endif }