/// <summary> /// Function to clear the timing data and reset any timers. /// </summary> /// <remarks>You do not need to call this method unless you've got your own mechanism for handling an idle time loop. /// <para>Values set by the user (e.g. <see cref="P:GorgonLibrary.Diagnostics.GorgonTiming.UseHighResolutionTimer">UseHighResolutionTimer</see>, <see cref="P:GorgonLibrary.Diagnostics.GorgonTiming.AverageFPS">MaxAverageCount</see>, etc...) will not be reset. /// The exception to this is if a high resolution timer is required but is not supported by the hardware.</para> /// </remarks> public static void Reset() { if ((_timer == null) || (UseHighResolutionTimer != _timer.IsHighResolution)) { _timer = new GorgonTimer(UseHighResolutionTimer); } _useHighResTimer = _timer.IsHighResolution; HighestFPS = float.MinValue; LowestFPS = float.MaxValue; AverageFPS = 0.0f; HighestDelta = float.MinValue; LowestDelta = float.MaxValue; AverageScaledDelta = 0.0f; AverageDelta = 0.0f; Delta = 0.0f; ScaledDelta = 0.0f; FPS = 0.0f; FrameCount = 0; _averageCounter = 0; _frameCounter = 0; _lastTime = 0.0; _lastTimerValue = 0.0; _averageFPSTotal = 0.0f; _averageScaledDeltaTotal = 0.0f; _timer.Reset(); }
/// <summary> /// Initializes a new instance of the <see cref="RawPointingDevice"/> class. /// </summary> /// <param name="owner">The control that owns this device.</param> /// <param name="deviceName">Device name.</param> /// <param name="handle">The handle to the device.</param> /// <exception cref="System.ArgumentNullException">Thrown when the owner parameter is NULL (or Nothing in VB.NET).</exception> internal RawPointingDevice(GorgonRawInputFactory owner, string deviceName, IntPtr handle) : base(owner, deviceName) { Gorgon.Log.Print("Raw input pointing device interface created for handle 0x{0}.", LoggingLevel.Verbose, handle.FormatHex()); _deviceHandle = handle; _doubleClicker = new GorgonTimer(); _doubleClicker.Reset(); _messageFilter = owner.MessageFilter; }
/// <summary> /// Initializes a new instance of the <see cref="Context" /> class. /// </summary> public Context() { // Create our timer object. _timer = new GorgonTimer(); // Create the splash screen and the main interface. _splashScreen = new formSplash(); MainForm = new formMain(); // Note that we're assign this to the inherited property 'MainForm'. // This how the application context knows which form controls the application. RunMe(); }
/// <summary> /// Function to clean up after an application exits. /// </summary> private static void CleanUp() { IsRunning = false; // Attach assembly resolving to deal with issues when loading assemblies with designers/type converters. AppDomain.CurrentDomain.AssemblyResolve -= ResolveAssembly; // Remove quit handlers. Application.ApplicationExit -= Application_ApplicationExit; Application.ThreadExit -= Application_ThreadExit; if (ApplicationIdleLoopMethod != null) { Application.Idle -= Application_Idle; Log.Print("Application loop stopped.", LoggingLevel.Simple); } if (_trackedObjects != null) { _trackedObjects.ReleaseAll(); } PlugIns.UnloadAll(); // Reset the low resolution timer period on application end. if (GorgonTimer.UsingLowResTimers) { GorgonTimer.ResetLowResTimerPeriod(); } Log.Print("Shutting down.", LoggingLevel.All); // Destroy log. if (!Log.IsClosed) { Log.Close(); } }
/// <summary> /// Initializes the <see cref="GorgonTiming"/> class. /// </summary> static GorgonTiming() { Reset(); TimeScale = 1; _appTimer = new GorgonTimer(); }