Пример #1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here
            _root.ProcessInput();
            _root.Update();
            base.Update(gameTime);
        }
Пример #2
0
        private void OnLoad(object sender, EventArgs e)
        {
            var wWallpaper = new Bitmap(@"XP.bmp");

            mWallpaperTexture = new Texture
            {
                Width  = wWallpaper.Width,
                Height = wWallpaper.Height
            };
            GL.BindTexture(TextureTarget.Texture2D, mWallpaperTexture.Id);
            var wData = wWallpaper.LockBits(new Rectangle(0, 0, mWallpaperTexture.Width, mWallpaperTexture.Height), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            GL.TexImage2D(TextureTarget.Texture2D, 0, PixelInternalFormat.Rgba8, mWallpaperTexture.Width, mWallpaperTexture.Height, 0, PixelFormat.Bgra, PixelType.UnsignedByte, wData.Scan0);
            wWallpaper.UnlockBits(wData);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)TextureMinFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)TextureMagFilter.Linear);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, (int)TextureWrapMode.Repeat);
            GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, (int)TextureWrapMode.Repeat);
            GL.BindTexture(TextureTarget.Texture2D, 0);

            mRoot.Update();
        }
Пример #3
0
        public void Update(DwarfTime time)
        {
            RootComponent.LocalBounds = new Rectangle(0, 0, GameState.Game.GraphicsDevice.Viewport.Width, GameState.Game.GraphicsDevice.Viewport.Height);
            ToolTipManager.Update(time);

            if (!IsMouseVisible)
            {
                return;
            }

            if (FocusComponent == null)
            {
                RootComponent.Update(time);
            }
            else
            {
                FocusComponent.Update(time);
            }

            LastScrollWheel = Mouse.GetState().ScrollWheelValue;
        }
Пример #4
0
 public void Update()
 {
     RootComponent.Update();
 }
Пример #5
0
 public void Update(GameTime time)
 {
     rootComponent.Update(this, time);
 }