Exemplo n.º 1
0
 public GameRunner()
 {
     Program.sdk.EarlyInitialize();
     if (!Program.releaseBuild)
     {
         base.InactiveSleepTime = new TimeSpan(0L);
     }
     Game1.graphics = new GraphicsDeviceManager(this);
     Game1.graphics.PreparingDeviceSettings += delegate(object sender, PreparingDeviceSettingsEventArgs args)
     {
         args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
     };
     Game1.graphics.PreferredBackBufferWidth  = 1280;
     Game1.graphics.PreferredBackBufferHeight = 720;
     base.Content.RootDirectory = "Content";
     LocalMultiplayer.Initialize();
     base.Window.AllowUserResizing = true;
     SubscribeClientSizeChange();
     base.Exiting += delegate(object sender, EventArgs args)
     {
         ExecuteForInstances(delegate(Game1 instance)
         {
             instance.exitEvent(sender, args);
         });
         Process.GetCurrentProcess().Kill();
     };
     Thread.CurrentThread.CurrentCulture       = CultureInfo.InvariantCulture;
     LocalizedContentManager.OnLanguageChange += delegate
     {
         ExecuteForInstances(delegate(Game1 instance)
         {
             instance.TranslateFields();
         });
     };
     DebugTools.GameConstructed(this);
 }
Exemplo n.º 2
0
        public GameRunner()
        {
            Program.sdk.EarlyInitialize();
            if (!Program.releaseBuild)
            {
                base.InactiveSleepTime = new TimeSpan(0L);
            }
            Game1.graphics = new GraphicsDeviceManager(this);
            Game1.graphics.PreparingDeviceSettings += delegate(object sender, PreparingDeviceSettingsEventArgs args)
            {
                args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
            };
            Game1.graphics.PreferredBackBufferWidth  = 1280;
            Game1.graphics.PreferredBackBufferHeight = 720;
            base.Content.RootDirectory = "Content";
            LocalMultiplayer.Initialize();
            bool first_attempt = true;

            MaxTextureSize = 65536;
            try
            {
                do
                {
                    if (!first_attempt)
                    {
                        MaxTextureSize /= 2;
                    }
                    first_attempt = false;
                    Type profile_capabilities2 = Assembly.GetAssembly(typeof(GraphicsProfile)).GetType("Microsoft.Xna.Framework.Graphics.ProfileCapabilities", throwOnError: true);
                    if (profile_capabilities2 != null)
                    {
                        FieldInfo max_texture_size2 = profile_capabilities2.GetField("MaxTextureSize", BindingFlags.Instance | BindingFlags.NonPublic);
                        FieldInfo hidef_profile2    = profile_capabilities2.GetField("HiDef", BindingFlags.Static | BindingFlags.NonPublic);
                        if (max_texture_size2 != null && hidef_profile2 != null)
                        {
                            hidef_profile2.GetValue(null);
                            max_texture_size2.SetValue(hidef_profile2.GetValue(null), MaxTextureSize);
                        }
                    }
                }while (MaxTextureSize > 4096 && !GraphicsAdapter.DefaultAdapter.IsProfileSupported(GraphicsProfile.HiDef));
            }
            catch (Exception)
            {
                MaxTextureSize = 4096;
                try
                {
                    Type profile_capabilities = Assembly.GetAssembly(typeof(GraphicsProfile)).GetType("Microsoft.Xna.Framework.Graphics.ProfileCapabilities", throwOnError: true);
                    if (profile_capabilities != null)
                    {
                        FieldInfo max_texture_size = profile_capabilities.GetField("MaxTextureSize", BindingFlags.Instance | BindingFlags.NonPublic);
                        FieldInfo hidef_profile    = profile_capabilities.GetField("HiDef", BindingFlags.Static | BindingFlags.NonPublic);
                        if (max_texture_size != null && hidef_profile != null)
                        {
                            hidef_profile.GetValue(null);
                            max_texture_size.SetValue(hidef_profile.GetValue(null), MaxTextureSize);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            base.Window.AllowUserResizing = true;
            SubscribeClientSizeChange();
            base.Exiting += delegate(object sender, EventArgs args)
            {
                ExecuteForInstances(delegate(Game1 instance)
                {
                    instance.exitEvent(sender, args);
                });
                Process.GetCurrentProcess().Kill();
            };
            Thread.CurrentThread.CurrentCulture       = CultureInfo.InvariantCulture;
            LocalizedContentManager.OnLanguageChange += delegate
            {
                ExecuteForInstances(delegate(Game1 instance)
                {
                    instance.TranslateFields();
                });
            };
            DebugTools.GameConstructed(this);
        }