001 package com.croftsoft.core.animation.factory; 002 003 import com.croftsoft.core.animation.AnimationFactory; 004 import com.croftsoft.core.animation.RepaintCollector; 005 import com.croftsoft.core.animation.collector.*; 006 import com.croftsoft.core.util.loop.LoopGovernor; 007 import com.croftsoft.core.util.loop.NanoTimeLoopGovernor; 008 009 /********************************************************************* 010 * Creates the default animation objects. 011 * 012 * @version 013 * $Date: 2008/04/19 21:27:14 $ 014 * @since 015 * 2002-03-09 016 * @author 017 * <a href="https://www.croftsoft.com/">David Wallace Croft</a> 018 *********************************************************************/ 019 020 public class DefaultAnimationFactory 021 implements AnimationFactory 022 ////////////////////////////////////////////////////////////////////// 023 ////////////////////////////////////////////////////////////////////// 024 { 025 026 public static final DefaultAnimationFactory INSTANCE 027 = new DefaultAnimationFactory ( ); 028 029 public static final double DEFAULT_FRAME_RATE = 85.0; 030 031 ////////////////////////////////////////////////////////////////////// 032 ////////////////////////////////////////////////////////////////////// 033 034 public RepaintCollector createRepaintCollector ( ) 035 ////////////////////////////////////////////////////////////////////// 036 { 037 return new CoalescingRepaintCollector ( ); 038 } 039 040 public LoopGovernor createLoopGovernor ( double frequency ) 041 ////////////////////////////////////////////////////////////////////// 042 { 043 return new NanoTimeLoopGovernor ( frequency ); 044 } 045 046 public LoopGovernor createLoopGovernor ( ) 047 ////////////////////////////////////////////////////////////////////// 048 { 049 return new NanoTimeLoopGovernor ( DEFAULT_FRAME_RATE ); 050 } 051 052 ////////////////////////////////////////////////////////////////////// 053 ////////////////////////////////////////////////////////////////////// 054 055 private DefaultAnimationFactory ( ) { } 056 057 ////////////////////////////////////////////////////////////////////// 058 ////////////////////////////////////////////////////////////////////// 059 }