/// <summary> /// Function to handle idle time for the application. /// </summary> /// <returns><b>true</b> to continue processing, <b>false</b> to stop.</returns> private static bool Idle() { // Rotate our pyramid. _angle += 45.0f * GorgonTiming.Delta; if (_angle > 360.0f) { _angle -= 360.0f; } // This will allow us to animate the center point of our pyramid. _heightOffset = _angle.ToRadians().FastSin().Abs(); // Send the animated variables to their respective shaders. UpdatedWorldProjection(); // Clear our render target. _swap.RenderTargetView.Clear(Color.CornflowerBlue); _depthStencil.ClearDepth(1.0f); _graphics.Submit(_drawCall); GorgonExample.BlitLogo(_graphics); // Send the contents of the swap chain buffers to the screen. _swap.Present(1); return(true); }
/// <summary> /// Function called during idle time. /// </summary> /// <returns><b>true</b> to continue execution, <b>false</b> to stop.</returns> private bool Idle() { _swap.RenderTargetView.Clear(GorgonColor.White); var windowSize = new DX.Size2F(ClientSize.Width, ClientSize.Height); var imageSize = new DX.Size2F(_texture.Width, _texture.Height); // Calculate the scale between the images. var scale = new DX.Size2F(windowSize.Width / imageSize.Width, windowSize.Height / imageSize.Height); // Only scale on a single axis if we don't have a 1:1 aspect ratio. if (scale.Height > scale.Width) { scale.Height = scale.Width; } else { scale.Width = scale.Height; } // Scale the image. var size = new DX.Size2((int)(scale.Width * imageSize.Width), (int)(scale.Height * imageSize.Height)); // Find the position. var bounds = new DX.Rectangle((int)((windowSize.Width / 2) - (size.Width / 2)), (int)((windowSize.Height / 2) - (size.Height / 2)), size.Width, size.Height); _graphics.DrawTexture(_texture, bounds); GorgonExample.BlitLogo(_graphics); _swap.Present(1); return(true); }
/// <summary> /// Function to handle idle time for the application. /// </summary> /// <returns><b>true</b> to continue processing, <b>false</b> to stop.</returns> private static bool Idle() { // This will clear the swap chain to the specified color. _swap.RenderTargetView.Clear(Color.CornflowerBlue); // Draw our triangle. _graphics.Submit(_drawCall); GorgonExample.BlitLogo(_graphics); // Now we flip our buffers on the swap chain. // We need to this or we won't see anything at all except the standard window background color. Clearly, we don't want that. // This method will take the current frame back buffer and flip it to the front buffer (the window). If we had more than one swap chain tied to multiple // windows, then we'd need to do this for every swap chain. _swap.Present(1); return(true); }