Update() публичный Метод

Update a texture from an image
public Update ( Image image ) : void
image Image Image to copy to the texture
Результат void
Пример #1
0
        public void Render(DoomApplication app)
        {
            if (app.State == ApplicationState.Opening)
            {
                openingSequence.Render(app.Opening);
            }
            else if (app.State == ApplicationState.Game)
            {
                RenderGame(app.Game);
            }

            if (app.Menu.Active)
            {
                menu.Render(app.Menu);
            }

            var screenData = screen.Data;
            var p          = MemoryMarshal.Cast <byte, uint>(sfmlTextureData);

            for (var i = 0; i < p.Length; i++)
            {
                p[i] = colors[screenData[i]];
            }

            sfmlTexture.Update(sfmlTextureData, (uint)screen.Height, (uint)screen.Width, 0, 0);

            sfmlWindow.Draw(sfmlSprite, sfmlStates);

            sfmlWindow.Display();
        }
Пример #2
0
        /// <summary>
        /// Draw the surface directly to the game window.  This will refresh the view,
        /// and Display the surface, as well as clear it if AutoClear is true.
        /// </summary>
        /// <param name="game">The Game to render to.</param>
        public void DrawToWindow(Game game)
        {
            RefreshView();

            Display();

            Drawable drawable = RenderShaders();

            game.Window.Draw(drawable, _states);

            if (_saveNextFrame)
            {
                _saveNextFrame = false;

                var texture = new SFML.Graphics.Texture(game.Window.Size.X, game.Window.Size.Y);
                texture.Update(game.Window);
                var capture = texture.CopyToImage();
                capture.SaveToFile(_saveNameFramePath);
            }

            if (AutoClear)
            {
                Clear(FillColor);
            }
        }
Пример #3
0
        private void Display(uint[] colors)
        {
            var screenData = screen.Data;
            var p          = MemoryMarshal.Cast <byte, uint>(sfmlTextureData);

            for (var i = 0; i < p.Length; i++)
            {
                p[i] = colors[screenData[i]];
            }
            sfmlTexture.Update(sfmlTextureData, (uint)screen.Height, (uint)screen.Width, 0, 0);
            sfmlWindow.Draw(sfmlSprite, sfmlStates);
            sfmlWindow.Display();
        }
Пример #4
0
        public Painter(RenderTarget target)
        {
            myTarget = target;
            myTexture = new Texture(1, 1);

            byte[] pixels = new byte[4];
            pixels[0] = pixels[1] = pixels[2] = pixels[3] = 255;
            myTexture.Update(pixels);
            myTexture.Repeated = true;

            myRect = new Sprite(myTexture);
            myRect.Position = new Vector2f(0f, 0f);

            Tint = Color.White;
        }
Пример #5
0
 static ImageInstance GrabImage(int x, int y, int w, int h)
 {
     Batch.Flush();
     w *= (Scaled ? 2 : 1);
     h *= (Scaled ? 2 : 1);
     Texture tex = new Texture((uint)w, (uint)h);
     tex.Update(_window, (uint)x, (uint)y);
     return new ImageInstance(_engine, tex, false);
 }