00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #import <Foundation/Foundation.h>
00027 #import "Support/uthash.h"
00028
00029 #import "ccTypes.h"
00030
00031 typedef void (*TICK_IMP)(id, SEL, ccTime);
00032
00033
00034
00035
00036
00038 @interface CCTimer : NSObject
00039 {
00040 id target;
00041 TICK_IMP impMethod;
00042
00043 ccTime elapsed;
00044
00045 @public
00046 ccTime interval;
00047 SEL selector;
00048 }
00049
00051 @property (nonatomic,readwrite,assign) ccTime interval;
00052
00055 +(id) timerWithTarget:(id) t selector:(SEL)s;
00056
00059 +(id) timerWithTarget:(id) t selector:(SEL)s interval:(ccTime)seconds;
00060
00063 -(id) initWithTarget:(id) t selector:(SEL)s;
00064
00067 -(id) initWithTarget:(id) t selector:(SEL)s interval:(ccTime)seconds;
00068
00069
00071 -(void) update: (ccTime) dt;
00072 @end
00073
00074
00075
00076
00077
00078
00091 struct _listEntry;
00092 struct _hashSelectorEntry;
00093 struct _hashUpdateEntry;
00094
00095 @interface CCScheduler : NSObject
00096 {
00097 ccTime timeScale_;
00098
00099
00100
00101
00102 struct _listEntry *updatesNeg;
00103 struct _listEntry *updates0;
00104 struct _listEntry *updatesPos;
00105 struct _hashUpdateEntry *hashForUpdates;
00106
00107
00108 struct _hashSelectorEntry *hashForSelectors;
00109 struct _hashSelectorEntry *currentTarget;
00110 BOOL currentTargetSalvaged;
00111
00112
00113 TICK_IMP impMethod;
00114 SEL updateSelector;
00115 }
00116
00124 @property (nonatomic,readwrite) ccTime timeScale;
00125
00127 +(CCScheduler *)sharedScheduler;
00128
00132 +(void)purgeSharedScheduler;
00133
00137 -(void) tick:(ccTime)dt;
00138
00146 -(void) scheduleSelector:(SEL)selector forTarget:(id)target interval:(ccTime)interval paused:(BOOL)paused;
00147
00153 -(void) scheduleUpdateForTarget:(id)target priority:(int)priority paused:(BOOL)paused;
00154
00159 -(void) unscheduleSelector:(SEL)selector forTarget:(id)target;
00160
00164 -(void) unscheduleUpdateForTarget:(id)target;
00165
00170 -(void) unscheduleAllSelectorsForTarget:(id)target;
00171
00177 -(void) unscheduleAllSelectors;
00178
00184 -(void) pauseTarget:(id)target;
00185
00191 -(void) resumeTarget:(id)target;
00192
00193
00199 -(void) scheduleTimer: (CCTimer*) timer DEPRECATED_ATTRIBUTE;
00200
00205 -(void) unscheduleTimer: (CCTimer*) timer DEPRECATED_ATTRIBUTE;
00206
00213 -(void) unscheduleAllTimers DEPRECATED_ATTRIBUTE;
00214 @end