public DrawingSurfaceSIS(IRenderer renderer1, IRenderer renderer2) { gameTime = new GameTime(); totalGameTime = new TimeSpan(); timer = new TimerTick(); IsFixedTimeStep = true; maximumElapsedTime = TimeSpan.FromMilliseconds(500.0); TargetElapsedTime = TimeSpan.FromTicks(10000000 / 60); // target elapsed time is by default 60Hz lastUpdateCount = new int[4]; nextLastUpdateCountIndex = 0; // Calculate the updateCountAverageSlowLimit (assuming moving average is >=3 ) // Example for a moving average of 4: // updateCountAverageSlowLimit = (2 * 2 + (4 - 2)) / 4 = 1.5f const int BadUpdateCountTime = 2; // number of bad frame (a bad frame is a frame that has at least 2 updates) var maxLastCount = 2 * Math.Min(BadUpdateCountTime, lastUpdateCount.Length); updateCountAverageSlowLimit = (float)(maxLastCount + (lastUpdateCount.Length - maxLastCount)) / lastUpdateCount.Length; timer.Reset(); gameTime.Update(totalGameTime, TimeSpan.Zero, false); //gameTime.FrameCount = 0; Init(renderer1, renderer2); }
//public DrawingSurfaceSIS(IRenderer renderer, DeviceManager deviceManager) public DrawingSurfaceSIS(Action<GameTime> updateRendererAction, Action<TargetBase> renderRendererAction, Action<DeviceManager> initializeRendererAction, Action<Windows.UI.Xaml.UIElement, Windows.UI.Xaml.UIElement> initializeUIRendererAction, Action<string> loadAssetUriRendererAction, Action unloadRendererAction, DeviceManager deviceManager) { _deviceManager = deviceManager; _updateRendererAction = updateRendererAction; _renderRendererAction = renderRendererAction; _initializeRendererAction = initializeRendererAction; _initializeUIRendererAction = initializeUIRendererAction; _loadAssetUriRendererAction = loadAssetUriRendererAction; _unloadRendererAction = unloadRendererAction; gameTime = new GameTime(); totalGameTime = new TimeSpan(); timer = new TimerTick(); IsFixedTimeStep = true; maximumElapsedTime = TimeSpan.FromMilliseconds(500.0); TargetElapsedTime = TimeSpan.FromTicks(10000000 / 60); // target elapsed time is by default 60Hz lastUpdateCount = new int[4]; nextLastUpdateCountIndex = 0; // Calculate the updateCountAverageSlowLimit (assuming moving average is >=3 ) // Example for a moving average of 4: // updateCountAverageSlowLimit = (2 * 2 + (4 - 2)) / 4 = 1.5f const int BadUpdateCountTime = 2; // number of bad frame (a bad frame is a frame that has at least 2 updates) var maxLastCount = 2 * Math.Min(BadUpdateCountTime, lastUpdateCount.Length); updateCountAverageSlowLimit = (float)(maxLastCount + (lastUpdateCount.Length - maxLastCount)) / lastUpdateCount.Length; timer.Reset(); //gameTime.Update(totalGameTime, TimeSpan.Zero, false); //gameTime.FrameCount = 0; //this.FrameCountPerRender = 1; //by default every frame results in a dxsurface render this.InitializeComponent(); //_effectRenderer = renderer; _hasEffectRenderer = true; }