コード例 #1
0
        protected override void Draw(int x, int y, bool active, ApplicationState state)
        {
            _disableCollectionRenderTrigger = true;
            PreRender?.Invoke(this, EventArgs.Empty);
            _disableCollectionRenderTrigger = false;

            var maxWidths = _keys.Select(key =>
                                         Items.Select(it => key.GetValue(it)?.ToString().Length ?? 4)
                                         .Append(key.Name.Length)
                                         .Max()).ToArray();

            var separatorBar = string.Join(" ", maxWidths.Select(w => '─'.Repeat(w + 2)));

            DrawUtil.Text(x, y, $"┌{separatorBar.Replace(' ', '┬')}┐");
            DrawUtil.Text(x, y + 1,
                          $"│{string.Join("│", _keys.Zip(maxWidths, (k, w) => $" {k.Name.PadRight(w)} "))}│");
            DrawUtil.Text(x, y + 2, $"├{separatorBar.Replace(' ', '┼')}┤");

            DrawUtil.Lines(
                x, y + 3,
                Items.Select(item =>
                             "│" +
                             string.Join("│",
                                         _keys.Zip(maxWidths, (key, width) =>
                                                   (" " + (key.GetValue(item)?.ToString() ?? "null") + " ").PadRight(width + 2)
                                                   )
                                         ) +
                             "│"
                             )
                );

            DrawUtil.Text(x, y + Items.Count + 3, $"└{separatorBar.Replace(' ', '┴')}┘");
        }
コード例 #2
0
            public override void OnPreRender()
            {
                if (Engine.GameFramework.IsInLevelLoad())
                {
                    return;
                }

                PreRender?.Invoke();
            }
コード例 #3
0
ファイル: OgreImage.cs プロジェクト: Pedlar/PacmanOgre
        protected void RenderFrame()
        {
            if ((_camera != null) && (_viewport == null))
            {
                _viewport = _renTarget.addViewport(_camera);
                _viewport.setBackgroundColour(new ColourValue(0.0f, 0.0f, 0.0f, 0.0f));
            }

            PreRender?.Invoke(this, EventArgs.Empty);

            _root.renderOneFrame();

            //GameWPF.Singleton.getRenderWindow().update();
            _renTarget.update();

            PostRender?.Invoke(this, EventArgs.Empty);
        }
コード例 #4
0
 public void OnPreRender()
 {
     PreRender?.Invoke(this, new EventArgs());
 }
コード例 #5
0
 private void OnPreRender()
 {
     PreRender?.Invoke(this, new RenderTargetEventArgs(target));
 }
コード例 #6
0
        //--------------------//

        /// <summary>
        /// Renders the view
        /// </summary>
        internal virtual void Render()
        {
            #region Sanity checks
            if (IsDisposed)
            {
                throw new ObjectDisposedException(ToString());
            }
            #endregion

            // Culling-debug information
            RenderedInLastFrame = true;
            Engine.QueueReset(this);

            #region Camera
            // If a cinematic camera has stopped moving, replace it with the final target
            if (_cinematicCamera != null && _targetCamera != null && !_cinematicCamera.Moving)
            {
                Camera           = _targetCamera;
                _cinematicCamera = null;
                _targetCamera    = null;
            }

            // Update transformation matrices
            Camera.Size = new Size(_viewport.Width, _viewport.Height);
            #endregion

            using (new ProfilerEvent(() => "Sort bodies for " + this))
                SortBodies();

            #region Child views
            if (_childViews.Count > 0)
            {
                using (new ProfilerEvent(() => "Child views of " + this))
                    HandleChildViews();
            }
            #endregion

            using (new ProfilerEvent(() => "Render " + this))
            {
                PreRender?.Invoke(Camera);

                Engine.Device.Viewport = _viewport;
                Engine.State.CullMode  = InvertCull ? Cull.Clockwise : Cull.Counterclockwise;

                // Setup fog
                if (Fog)
                {
                    Engine.State.Fog      = true;
                    Engine.State.FogColor = _backgroundColor;
                    Engine.State.FogStart = Camera.NearClip;
                    Engine.State.FogEnd   = Camera.FarClip;
                }
                else
                {
                    Engine.State.Fog = false;
                }

                // Activate render-to-texture for external render targets and alpha blending
                bool sceneOnBackBuffer = !TextureRenderTarget && FullAlpha == 0;

                // Render scene
                if (sceneOnBackBuffer)
                {
                    RenderSceneToBackBuffer();
                }
                else
                {
                    RenderSceneToTexture();
                }

                // Post-screen shaders
                if (Engine.Effects.PostScreenEffects && PostShaders.Count > 0)
                {
                    using (new ProfilerEvent("Applying post-screen shaders"))
                        ApplyPostShaders(sceneOnBackBuffer);
                }
            }
        }