コード例 #1
0
        public void ReleaseWindowSizeDependentResources()
        {
            D2D1Utils.DisposeAndNull(ref this.bitmap);
            D2D1Utils.DisposeAndNull(ref this.bitmapBrush);

            D2D1Utils.DisposeAndNull(ref this.textBrush);
            DWriteUtils.DisposeAndNull(ref this.textLayout);
        }
コード例 #2
0
        public void Update(StepTimer timer)
        {
            if (!this.IsEnabled)
            {
                return;
            }

            if (timer == null)
            {
                throw new ArgumentNullException("timer");
            }

            var  time = timer.TotalTime;
            uint fps  = timer.FramesPerSecond;

            text.Clear();

            if (this.ShowPerformanceTime)
            {
                text.Append("E:");
                text.Append(this.performanceTime.EventTime);
                text.Append(", U:");
                text.Append(this.performanceTime.UpdateTime);
                text.Append(", R:");
                text.Append(this.performanceTime.RenderTime);
                text.Append(", P:");
                text.Append(this.performanceTime.PresentTime);
                text.Append("\n");
            }

            if (this.ShowTime)
            {
                text.Append(time);
                text.Append("\n");
            }

            if (fps > 0)
            {
                text.Append(fps);
            }
            else
            {
                text.Append("-");
            }

            text.Append(" FPS");

            DWriteUtils.DisposeAndNull(ref this.textLayout);
            this.textLayout = this.deviceResources.DWriteFactory.CreateTextLayout(text.ToString(), this.textFormat, 600, 400);

            this.isInitialized = true;
        }
コード例 #3
0
 public void ReleaseDeviceDependentResources()
 {
     D2D1Utils.DisposeAndNull(ref this.stateBlock);
     DWriteUtils.DisposeAndNull(ref this.textFormat);
 }