Пример #1
0
        /// <summary>
        /// コンストラクタ
        /// (new で実体生成された際、一番最初に一回呼び出される)
        /// </summary>
        public Game1()
        {
            IGConfig.IGConfigLoad();
            //グラフィックスデバイス管理者の実体生成
            graphicsDeviceManager = new GraphicsDeviceManager(this);
            if (IGConfig.isFullScreen)
            {
                System.Windows.Forms.Screen screen = System.Windows.Forms.Screen.PrimaryScreen;
                int tempsWidth  = screen.Bounds.Width;
                int tempsHeight = screen.Bounds.Height;
                tempScreen = new InfinityGame.Element.Size(tempsWidth, tempsHeight);

                if (IGConfig.screen.Width > tempsWidth)
                {
                    IGConfig.screen.Width = tempsWidth;
                }
                if (IGConfig.screen.Height > tempsHeight)
                {
                    IGConfig.screen.Height = tempsHeight;
                }
                ChangeScreen.ChangeResolution(IGConfig.screen.Width, IGConfig.screen.Height);
            }
            graphicsDeviceManager.PreferredBackBufferWidth  = IGConfig.screen.Width;
            graphicsDeviceManager.PreferredBackBufferHeight = IGConfig.screen.Height;
            graphicsDeviceManager.IsFullScreen = IGConfig.isFullScreen;
            //コンテンツデータ(リソースデータ)のルートフォルダは"Contentに設定
            Content.RootDirectory = "Content";
            IGConfig.MNCT         = Content;
            //IsMouseVisible = true;
        }
Пример #2
0
        public static void Load(string physicalPath)
        {
            if (!File.Exists(physicalPath))
            {
                throw new Exception(string.Format("No Settings file found in {0}", physicalPath));
            }
            string data = File.ReadAllText(physicalPath, Encoding.UTF8);

            if (string.IsNullOrEmpty(data))
            {
                throw new Exception(string.Format("No data found in {0}", physicalPath));
            }
            try {
                gConfig = JsonConvert.DeserializeObject <GConfig>(data, jsonSettings);
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }