Ejemplo n.º 1
0
 internal GraphicsAdapter(
     DisplayMode currentMode,
     DisplayModeCollection modes,
     string description
     )
 {
     CurrentDisplayMode    = currentMode;
     SupportedDisplayModes = modes;
     Description           = description;
     UseNullDevice         = false;
     UseReferenceDevice    = false;
 }
Ejemplo n.º 2
0
 internal GraphicsAdapter(
     DisplayModeCollection modes,
     string name,
     string description
     )
 {
     SupportedDisplayModes = modes;
     DeviceName            = name;
     Description           = description;
     UseNullDevice         = false;
     UseReferenceDevice    = false;
 }
Ejemplo n.º 3
0
		private void INTERNAL_GenerateDisplayModes()
		{
			List<DisplayMode> modes = new List<DisplayMode>();
			SDL.SDL_DisplayMode filler = new SDL.SDL_DisplayMode();
			int numModes = SDL.SDL_GetNumDisplayModes(displayIndex);
			for (int i = 0; i < numModes; i += 1)
			{
				SDL.SDL_GetDisplayMode(displayIndex, i, out filler);

				// Check for dupes caused by varying refresh rates.
				bool dupe = false;
				foreach (DisplayMode mode in modes)
				{
					if (filler.w == mode.Width && filler.h == mode.Height)
					{
						dupe = true;
					}
				}
				if (!dupe)
				{
					modes.Add(
						new DisplayMode(
							filler.w,
							filler.h,
							SurfaceFormat.Color // FIXME: Assumption!
						)
					);
				}
			}
			supportedDisplayModes = new DisplayModeCollection(modes);
		}
Ejemplo n.º 4
0
 public GraphicsAdapter(DisplayModeCollection modes, string name, string description)
 {
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content. Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //this.deviceManager.GraphicsDevice.SamplerStates[0].Filter = TextureFilter.Linear;

            #region Services
            ServicesManager.AddService<GraphicsDevice>( GraphicsDevice );
            ServicesManager.AddService<ContentManager>( Content );

            #endregion

            #region Initialisation des paramètres graphiques.
            // TODO: Géré la config externe
            displayModes = ServicesManager.GetService<GraphicsDevice>().Adapter.SupportedDisplayModes;
            Window.AllowUserResizing = false;
            Window.Title = "Phobos v0.0";
            //set windows to 1280x768
            deviceManager.PreferredBackBufferWidth = 1280;
            deviceManager.PreferredBackBufferHeight = 640;

            //Limitation des refresh a 60 par seconde
            deviceManager.SynchronizeWithVerticalRetrace = false; //uncomment to got real FPS
            //IsFixedTimeStep = true;
            TargetElapsedTime = new TimeSpan(0, 0, 0, 0, 13);

            deviceManager.ApplyChanges();

            #endregion

            #region Initialisation du clavier
            string currentLayout = (new WindowsKeyboardExtractor()).getCurrentSystemLayout();
            /*if (PhobosConfigurationManager.Source.Configs["Keyboard"] == null || PhobosConfigurationManager.Source.Configs["Keyboard"].Get("lastKeyboardLayout") == null)
            {

                PhobosConfigurationManager.set("Keyboard", "lastKeyboardLayout", currentLayout);
            }
            else
            {
                Console.WriteLine("bam");
                PhobosConfigurationManager.set("Keyboard", "lastKeyboardLayout", currentLayout);
            }*/
            #endregion

            ContentHelper.Initialize();
            MouseHandler.Initialize();
            MouseHandler.HorizontalyShaked += delegate( MouseEvent e ) {
                //Console.WriteLine( "Dont shake it too much or it will hurt !" );
            };
            #region GameStateManager
            GameStateManager.Initialize();
            #endregion

            //SetWindowedFullScreen();
            base.Initialize();
        }
Ejemplo n.º 6
0
		internal GraphicsAdapter(
			DisplayMode currentMode,
			DisplayModeCollection modes,
			string description
		) {
			CurrentDisplayMode = currentMode;
			SupportedDisplayModes = modes;
			Description = description;
			UseNullDevice = false;
			UseReferenceDevice = false;
		}
Ejemplo n.º 7
0
        public Game1()
        {
            //General XNA setup
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.MinimumVertexShaderProfile = ShaderProfile.VS_2_0;
            graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;

            //Enumerate the available display modes
            // graphicsadapter has supporteddisplaymodes

            GraphicsAdapter gdi = GraphicsAdapter.DefaultAdapter;
            AvailableModes = gdi.SupportedDisplayModes;

            ModeList = new List<DisplayMode>();
            foreach (DisplayMode d in AvailableModes)
            {
                ModeList.Add(d);
            }

            //((DisplayMode)Modes[0]).Width

            //Load configuration
            Stage = StageManager.CreateFromConfigFile("monstermaze.config");
            graphics.PreferredBackBufferWidth = Stage.ConfigurationSettings.width;
            graphics.PreferredBackBufferHeight = Stage.ConfigurationSettings.Height;

            //graphics.PreferredBackBufferWidth = 1600;
            //graphics.PreferredBackBufferHeight = 1200;

            graphics.IsFullScreen = Stage.ConfigurationSettings.Fullscreen;

            OptionsFullscreen = Stage.ConfigurationSettings.Fullscreen;
            OptionsDisplayModeHeight = Stage.ConfigurationSettings.Height;
            OptionsDisplayModeWidth = Stage.ConfigurationSettings.width;

            try
            {
                //Load the extra config file.
                ExtraConfigFile = ExtraConfig.LoadFromFile("CCExtra.config");
            }
            catch
            {
                //If the extra config file isn't found (or can't be loaded) create a new one with default settings and save that.
                ExtraConfigFile = new ExtraConfig();
                ExtraConfigFile.ExtraBoolSettings = new Dictionary<string, bool>();
                ExtraConfigFile.ExtraFloatSettings = new Dictionary<string, float>();
                ExtraConfigFile.SaveTofile("CCExtra.config");
            }

            //floats
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("ViewDistance"))
                ExtraConfigFile.ExtraFloatSettings["ViewDistance"] = 50.0f;
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("SoundVolume"))
                ExtraConfigFile.ExtraFloatSettings["SoundVolume"] = 50.0f;
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("MusicVolume"))
                ExtraConfigFile.ExtraFloatSettings["MusicVolume"] = 40.0f;
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("BloomLevel"))
                ExtraConfigFile.ExtraFloatSettings["BloomLevel"] = 50.0f;
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("ParticleDensity"))
                ExtraConfigFile.ExtraFloatSettings["ParticleDensity"] = 100.0f;
            if (!ExtraConfigFile.ExtraFloatSettings.Keys.Contains("TextureSampler"))
                ExtraConfigFile.ExtraFloatSettings["TextureSampler"] = 99.0f;

            OptionsBloomLevel = ExtraConfigFile.ExtraFloatSettings["BloomLevel"];
            OptionsParticleDensity = ExtraConfigFile.ExtraFloatSettings["ParticleDensity"];
            OptionsSFXVolume = ExtraConfigFile.ExtraFloatSettings["SoundVolume"];
            OptionsTextureSampler = ExtraConfigFile.ExtraFloatSettings["TextureSampler"];
            OptionsViewDistance = ExtraConfigFile.ExtraFloatSettings["ViewDistance"];
            OptionsMusicVolume = ExtraConfigFile.ExtraFloatSettings["MusicVolume"];

            //bools
            if (!ExtraConfigFile.ExtraBoolSettings.Keys.Contains("BloomOn"))
                ExtraConfigFile.ExtraBoolSettings["BloomOn"] = true;
            if (!ExtraConfigFile.ExtraBoolSettings.Keys.Contains("SFXMute"))
                ExtraConfigFile.ExtraBoolSettings["SFXMute"] = false;
            if (!ExtraConfigFile.ExtraBoolSettings.Keys.Contains("MusicMute"))
                ExtraConfigFile.ExtraBoolSettings["MusicMute"] = false;

            OptionsBloomOn = ExtraConfigFile.ExtraBoolSettings["BloomOn"];
            OptionsMuteMusic = ExtraConfigFile.ExtraBoolSettings["MusicMute"];
            OptionsMuteSFX = ExtraConfigFile.ExtraBoolSettings["SFXMute"];

            graphics.PreferredDepthStencilFormat = DepthFormat.Depth32;

            random = new Random();
            for(int i=0;i<10;i++)
                random.Next(1,1000);

            //Particles
            #region Particle system test
            // Construct our particle system components.
            //explosionParticles = new ExplosionParticleSystem(this, Content);
            //explosionSmokeParticles = new ExplosionSmokeParticleSystem(this, Content);
            //projectileTrailParticles = new ProjectileTrailParticleSystem(this, Content);
            smokePlumeParticles = new SmokePlumeParticleSystem(this, Content,(int)OptionsParticleDensity);
            fireParticles = new FireParticleSystem(this, Content, (int)OptionsParticleDensity);
            antifireParticles = new AntiFireParticleSystem(this, Content, (int)OptionsParticleDensity);

            // Set the draw order so the explosions and fire
            // will appear over the top of the smoke.
            //smokePlumeParticles.DrawOrder =
            //explosionSmokeParticles.DrawOrder = 200;
            //projectileTrailParticles.DrawOrder = 300;
            //explosionParticles.DrawOrder = 400;
            //fireParticles.DrawOrder = 500;

            // Register the particle system components.
            //Components.Add(explosionParticles);
            //Components.Add(explosionSmokeParticles);
            //Components.Add(projectileTrailParticles);
            //Components.Add(smokePlumeParticles);
            //Components.Add(fireParticles);
            #endregion

            //Bloom
            bloom = new BloomComponent(this);
            bloom.Settings = BloomSettings.PresetSettings[bloomSettingsIndex];
            bloom.FadeSettings = new PostFadeSettings();

            //Components.Add(bloom);

            bloom.Settings.BloomIntensity = 3.0f * (OptionsBloomLevel / 100);
        }