Exemple #1
0
 /// <summary>
 /// Raises the tick event.
 /// </summary>
 /// <param name='ergs'>
 /// Ergs.
 /// </param>
 internal static void OnTick(TickEventArgs ergs)
 {
     if (Tick != null)
     {
         Tick(__instance, ergs);
     }
 }
Exemple #2
0
        /// <summary>
        /// Threads the ticker.
        /// </summary>
        private static void ThreadTicker()
        {
            int frames    = 0;
            int last_time = Timer.TickElapsed;
            int current_tick;
            int target_tick;

            while (!__quit_flag)
            {
                while (Events.Poll())
                {
                    ;
                }

                current_tick = Timer.TickElapsed;
                target_tick  = last_time + (int)__ticks_per_frame;

                if (current_tick <= target_tick)
                {
                    Thread.Sleep(target_tick - current_tick);
                }

                current_tick = Timer.TickElapsed;

                Events.OnTick(TickEventArgs.CreateEventArgs(current_tick, last_time, __fps));
                last_time = current_tick;

                ++frames;

                if (last_time + 1000 <= current_tick)
                {
                    __fps     = frames;
                    frames    = 0;
                    last_time = current_tick;
                }
            }
        }
Exemple #3
0
		/// <summary>
		/// Raises the tick event.
		/// </summary>
		/// <param name='ergs'>
		/// Ergs.
		/// </param>
        internal static void OnTick(TickEventArgs ergs) {
            if ( Tick != null )
                Tick( __instance, ergs );
        }