private void AnimationTimer_Tick(object sender, EventArgs e) { // Change triangle rotation _Angle = (_Angle + 0.1f) % 90.0f; // Issue a new frame after this render RenderControl.Invalidate(); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DrawTimer_Tick(object sender, EventArgs e) { RenderControl.Invalidate(); }
private void Update() { var wasInvalidated = isInvalidated; isInvalidated = false; if (!form.Visible || !form.CanFocus || !renderControl.IsHandleCreated) { return; } UnclampedDelta = (float)stopwatch.Elapsed.TotalSeconds; float delta = Mathf.Clamp(UnclampedDelta, 0, Application.MaxDelta); stopwatch.Restart(); if (this == Application.MainWindow && Application.MainMenu != null) { Application.MainMenu.Refresh(); } fpsCounter.Refresh(); // Refresh mouse position of every frame to make HitTest work properly if mouse is outside of the screen. RefreshMousePosition(); if (active || Input.IsSimulationRunning) { Input.ProcessPendingInputEvents(delta); } if (Input.IsSimulationRunning) { Application.Input.Simulator.OnProcessingPendingInputEvents(); } RaiseUpdating(delta); AudioSystem.Update(); if (active || Input.IsSimulationRunning) { Input.CopyKeysState(); Input.TextInput = null; } if (wasInvalidated || renderingState == RenderingState.RenderDeferred) { renderControl.Invalidate(); } // We give one update cycle to handle files drop // (files dropped event may be fired inside update) if (Input.DroppedFiles.Count > 0 || shouldCleanDroppedFiles) { if (shouldCleanDroppedFiles) { Input.DroppedFiles.Clear(); } shouldCleanDroppedFiles = !shouldCleanDroppedFiles; } renderingState = renderControl.CanRender ? RenderingState.Updated : RenderingState.Rendered; WaitForRendering(); if (renderControl.CanRender) { RaiseSync(); if (AsyncRendering) { renderCompleted.Reset(); renderReady.Set(); } } }