예제 #1
0
        public override void Initialize()
        {
            // Set OPENGL VSync to Off
            var window = (OpenTK.GameWindow) this.GetType().BaseType.GetField("window", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this);

            window.VSync = OpenTK.VSyncMode.Off;

            this.game = new RLEnvs.Game();
            this.game.Initialize(this);
            WaveServices.Random.Seed = this.seed;

            #region DEFAULT SPLASHSCREEN
            this.backgroundSplashColor = Color.White;
            this.spriteBatch           = new SpriteBatch(WaveServices.GraphicsDevice);

            var    resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
            string name          = string.Empty;

            foreach (string item in resourceNames)
            {
                if (item.Contains("SplashScreen.png"))
                {
                    name = item;
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new InvalidProgramException("License terms not agreed.");
            }

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
            {
                this.splashScreen = Texture2D.FromFile(WaveServices.GraphicsDevice, stream);
            }
            #endregion
        }
예제 #2
0
파일: App.cs 프로젝트: PlainConcepts/ARLIE
        public override void Initialize()
        {
            this.game = new RLEnvs.Game();
            this.game.Initialize(this);
            WaveServices.Random.Seed = this.seed;

            #region DEFAULT SPLASHSCREEN
            this.backgroundSplashColor = Color.White;
            this.spriteBatch           = new SpriteBatch(WaveServices.GraphicsDevice);

            var    resourceNames = Assembly.GetExecutingAssembly().GetManifestResourceNames();
            string name          = string.Empty;

            foreach (string item in resourceNames)
            {
                if (item.Contains("SplashScreen.png"))
                {
                    name = item;
                    break;
                }
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new InvalidProgramException("License terms not agreed.");
            }

            using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name))
            {
                this.splashScreen = Texture2D.FromFile(WaveServices.GraphicsDevice, stream);
            }

            position   = new Vector2();
            position.X = (this.Width / 2.0f) - (this.splashScreen.Width / 2.0f);
            position.Y = (this.Height / 2.0f) - (this.splashScreen.Height / 2.0f);
            #endregion
        }