示例#1
0
        /// <summary>
        /// Function to draw the sprite editor functionality.
        /// </summary>
        private void DrawSpriteEdit()
        {
            _content.Sprite.Scale = new Vector2(1);

            DrawSpriteTexture();

            // Offset the clipping rectangle so that it appears in the correct place on the screen.
            _clipper.Draw();

            Vector2 mousePosition = panelSprite.PointToClient(Cursor.Position);

            _content.Renderer.Drawing.BlendingMode = BlendingMode.Inverted;

            _content.Renderer.Drawing.DrawLine(new Vector2(mousePosition.X, 0), new Vector2(mousePosition.X, panelSprite.ClientSize.Height), Color.White);
            _content.Renderer.Drawing.DrawLine(new Vector2(0, mousePosition.Y), new Vector2(panelSprite.ClientSize.Width, mousePosition.Y), Color.White);

            _content.Renderer.Drawing.BlendingMode = BlendingMode.Modulate;

            if (_zoomWindow != null)
            {
                _zoomWindow.Draw();
            }

            if (panelSprite.Focused)
            {
                return;
            }

            // If the window does not have focus, then draw an overlay.
            _content.Renderer.Drawing.FilledRectangle(panelSprite.ClientRectangle, new GorgonColor(panelSprite.BackColor, 0.5f));
        }
示例#2
0
        /// <summary>
        /// Function to execute during idle time.
        /// </summary>
        /// <returns>TRUE to continue executing, FALSE to stop.</returns>
        private bool Idle()
        {
            _renderer.Drawing.TextureSampler.HorizontalWrapping = TextureAddressing.Wrap;
            _renderer.Drawing.TextureSampler.VerticalWrapping   = TextureAddressing.Wrap;

            _renderer.Drawing.Blit(_defaultTexture,
                                   new RectangleF(0, 0, panelTextureDisplay.Width, panelTextureDisplay.Height),
                                   _defaultTexture.ToTexel(panelTextureDisplay.ClientRectangle));

            _renderer.Drawing.TextureSampler.HorizontalWrapping = TextureAddressing.Clamp;
            _renderer.Drawing.TextureSampler.VerticalWrapping   = TextureAddressing.Clamp;

            if (Texture == null)
            {
                _renderer.Render(2);
                return(true);
            }

            _renderer.Drawing.Blit(Texture,
                                   _displayRegion,
                                   new RectangleF(0, 0, 1, 1));

            _clipper.Draw();

            _renderer.Render(2);
            return(true);
        }