diff options
Diffstat (limited to 'libs/cocos2d/CCNotifications.h')
-rwxr-xr-x | libs/cocos2d/CCNotifications.h | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/libs/cocos2d/CCNotifications.h b/libs/cocos2d/CCNotifications.h new file mode 100755 index 0000000..8609801 --- /dev/null +++ b/libs/cocos2d/CCNotifications.h | |||
@@ -0,0 +1,141 @@ | |||
1 | /* | ||
2 | * CCNotifications | ||
3 | * | ||
4 | * Copyright (c) 2010 ForzeField Studios S.L. | ||
5 | * http://forzefield.com | ||
6 | * | ||
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
8 | * of this software and associated documentation files (the "Software"), to deal | ||
9 | * in the Software without restriction, including without limitation the rights | ||
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
11 | * copies of the Software, and to permit persons to whom the Software is | ||
12 | * furnished to do so, subject to the following conditions: | ||
13 | * | ||
14 | * The above copyright notice and this permission notice shall be included in | ||
15 | * all copies or substantial portions of the Software. | ||
16 | * | ||
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
23 | * THE SOFTWARE. | ||
24 | * | ||
25 | */ | ||
26 | |||
27 | #import <Foundation/Foundation.h> | ||
28 | #import "cocos2d.h" | ||
29 | |||
30 | #define KNOTIFICATIONMIN_SCALE 0.0001f | ||
31 | |||
32 | @interface ccNotificationData : NSObject | ||
33 | { | ||
34 | NSString *title_; | ||
35 | NSString *message_; | ||
36 | id media_; | ||
37 | int mediaType_; | ||
38 | int tag_; | ||
39 | BOOL animated_; | ||
40 | } | ||
41 | @property(nonatomic, retain) NSString *title; | ||
42 | @property(nonatomic, retain) NSString *message; | ||
43 | @property(nonatomic, retain) id media; | ||
44 | @property(nonatomic, readwrite, assign) int mediaType; | ||
45 | @property(nonatomic, readwrite, assign) int tag; | ||
46 | @property(nonatomic, readwrite, assign) BOOL animated; | ||
47 | |||
48 | @end | ||
49 | |||
50 | @protocol CCNotificationsDelegate <NSObject> | ||
51 | @optional | ||
52 | - (void) notification:(ccNotificationData*)notification newState:(char)state; | ||
53 | - (BOOL) touched:(int)tag; | ||
54 | - (void) notificationChangeState:(char)state tag:(int)tag DEPRECATED_ATTRIBUTE; | ||
55 | @end | ||
56 | |||
57 | @protocol CCNotificationDesignProtocol <NSObject> | ||
58 | - (void) setTitle:(NSString*)title message:(NSString*)message texture:(CCTexture2D*)texture; | ||
59 | @end | ||
60 | |||
61 | enum | ||
62 | { | ||
63 | kCCNotificationStateHide, | ||
64 | kCCNotificationStateAnimationOut, | ||
65 | kCCNotificationStateShowing, | ||
66 | kCCNotificationStateAnimationIn, | ||
67 | }; | ||
68 | |||
69 | enum | ||
70 | { | ||
71 | kCCNotificationPositionBottom, | ||
72 | kCCNotificationPositionTop, | ||
73 | }; | ||
74 | |||
75 | enum | ||
76 | { | ||
77 | kCCNotificationAnimationMovement, | ||
78 | kCCNotificationAnimationScale, | ||
79 | }; | ||
80 | |||
81 | enum | ||
82 | { | ||
83 | kCCNotificationMediaPath, | ||
84 | kCCNotificationMediaTexture, | ||
85 | }; | ||
86 | |||
87 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
88 | @interface CCNotifications : NSObject <CCStandardTouchDelegate> | ||
89 | #elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED) | ||
90 | @interface CCNotifications : NSObject | ||
91 | #endif | ||
92 | { | ||
93 | id <CCNotificationsDelegate> delegate_; | ||
94 | CCNode <CCNotificationDesignProtocol> *template_; | ||
95 | char state_; | ||
96 | char position_; | ||
97 | ccTime showingTime_; | ||
98 | ccTime timeAnimationIn_; | ||
99 | ccTime timeAnimationOut_; | ||
100 | char typeAnimationIn_; | ||
101 | char typeAnimationOut_; | ||
102 | |||
103 | //Caching | ||
104 | CCArray *cachedNotifications_; | ||
105 | ccNotificationData *currentNotification_; | ||
106 | |||
107 | CCActionInterval *animationIn_; | ||
108 | CCActionInterval *animationOut_; | ||
109 | } | ||
110 | @property(nonatomic, retain) id <CCNotificationsDelegate> delegate; | ||
111 | @property(nonatomic, retain) CCNode <CCNotificationDesignProtocol> *notificationDesign; | ||
112 | @property(nonatomic, retain) CCActionInterval *animationIn; | ||
113 | @property(nonatomic, retain) CCActionInterval *animationOut; | ||
114 | @property(nonatomic, retain) ccNotificationData *currentNotification; | ||
115 | @property(nonatomic, readwrite, assign) char position; | ||
116 | @property(nonatomic, readwrite, assign) ccTime showingTime; | ||
117 | |||
118 | + (CCNotifications *) sharedManager; | ||
119 | + (void) purgeSharedManager; | ||
120 | + (id) systemWithTemplate:(CCNode <CCNotificationDesignProtocol> *)notifications; | ||
121 | |||
122 | - (id) initWithTemplate:(CCNode <CCNotificationDesignProtocol> *)templates; | ||
123 | - (void) setAnimationIn:(char)type time:(ccTime)time; | ||
124 | - (void) setAnimationOut:(char)type time:(ccTime)time; | ||
125 | - (void) setAnimation:(char)type time:(ccTime)time; | ||
126 | - (void) updateAnimations; | ||
127 | |||
128 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message image:(NSString*)image tag:(int)tag animate:(BOOL)animate waitUntilDone:(BOOL)isCached; | ||
129 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message texture:(CCTexture2D*)texture tag:(int)tag animate:(BOOL)animate waitUntilDone:(BOOL)isCached; | ||
130 | |||
131 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message image:(NSString*)image tag:(int)tag animate:(BOOL)animate; | ||
132 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message texture:(CCTexture2D*)texture tag:(int)tag animate:(BOOL)animate; | ||
133 | |||
134 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message image:(NSString*)image; | ||
135 | - (ccNotificationData*) addWithTitle:(NSString*)title message:(NSString*)message texture:(CCTexture2D*)texture; | ||
136 | |||
137 | - (void) addSafelyWithTitle:(NSString*)title message:(NSString*)message image:(NSString*)image tag:(int)tag animate:(BOOL)animate DEPRECATED_ATTRIBUTE; | ||
138 | |||
139 | |||
140 | - (void) visit; | ||
141 | @end \ No newline at end of file | ||