예제 #1
0
 public Mini2DxGame(GameContainer game)
 {
     Window.AllowUserResizing = true;
     IsMouseVisible           = true;
     IsFixedTimeStep          = false;
     graphics = new GraphicsDeviceManager(this);
     graphics.PreparingDeviceSettings += (object s, PreparingDeviceSettingsEventArgs args) =>
     {
         args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
     };
     Content.RootDirectory              = "Content";
     graphics.PreferredBackBufferWidth  = 800;
     graphics.PreferredBackBufferHeight = 720;
     this.game = game;
     instance  = this;
 }
예제 #2
0
        public Mini2DxGame(string gameIdentifier, GameContainer game, MonoGameConfig config)
        {
            Mdx.gameIdentifier_ = gameIdentifier;
            Mdx.locks_          = new MonoGameLocks();
            XmlSerializer xmlSerializer = new XmlSerializer();

            xmlSerializer._init_();
            Mdx.xml_ = xmlSerializer;
            JsonSerializer jsonSerializer = new JsonSerializer();

            jsonSerializer._init_();
            Mdx.json_ = jsonSerializer;

            if (config.AllowUserResizing.HasValue)
            {
                Window.AllowUserResizing = config.AllowUserResizing.Value;
            }
            if (config.IsMouseVisible.HasValue)
            {
                IsMouseVisible = config.IsMouseVisible.Value;
            }

            IsFixedTimeStep = config.IsFixedTimeStep;
            graphics        = new GraphicsDeviceManager(this);
            graphics.PreparingDeviceSettings += (object s, PreparingDeviceSettingsEventArgs args) =>
            {
                args.GraphicsDeviceInformation.PresentationParameters.RenderTargetUsage = RenderTargetUsage.PreserveContents;
            };
            Content.RootDirectory = "Content";

            if (config.PreferredBackBufferWidth.HasValue && config.PreferredBackBufferHeight.HasValue)
            {
                graphics.PreferredBackBufferWidth  = config.PreferredBackBufferWidth.Value;
                graphics.PreferredBackBufferHeight = config.PreferredBackBufferHeight.Value;
            }
            if (config.IsFullScreen.HasValue)
            {
                graphics.IsFullScreen = config.IsFullScreen.Value;
            }

            this.game   = game;
            this.config = config;
            instance    = this;
        }