Skip to content

Commit 1d1b596

Browse files
committed
Merge remote-tracking branch 'origin/v3.4.9' into develop-v3.5
2 parents 868364e + d8f6fb8 commit 1d1b596

File tree

4 files changed

+67
-61
lines changed

4 files changed

+67
-61
lines changed

cocos2d-ui/CCScrollView.m

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,8 +756,14 @@ - (void) onEnterTransitionDidFinish
756756

757757
NSMutableArray* recognizers = [view.gestureRecognizers mutableCopy];
758758
if (!recognizers) recognizers = [NSMutableArray arrayWithCapacity:2];
759-
[recognizers insertObject:_panRecognizer atIndex:0];
760-
[recognizers insertObject:_tapRecognizer atIndex:0];
759+
760+
if ([recognizers containsObject:_panRecognizer] == NO) {
761+
[recognizers insertObject:_panRecognizer atIndex:0];
762+
}
763+
764+
if ([recognizers containsObject:_tapRecognizer] == NO) {
765+
[recognizers insertObject:_tapRecognizer atIndex:0];
766+
}
761767

762768
view.gestureRecognizers = recognizers;
763769
[super onEnterTransitionDidFinish];

cocos2d/CCActionEase.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,12 @@
136136
* CCActionEaseRate adds an additional rate property to control the rate of change for the specified action.
137137
*/
138138
@interface CCActionEaseRate : CCActionEase <NSCopying> {
139-
float _rate;
139+
CGFloat _rate;
140140
}
141141

142142
// purposefully undocumented: little need to change rate while action is running
143143
/* Rate value for the ease action. */
144-
@property (nonatomic,readwrite,assign) float rate;
144+
@property (nonatomic,readwrite,assign) CGFloat rate;
145145

146146
/** @name Creating an Ease Action */
147147

@@ -153,7 +153,7 @@
153153
*
154154
* @return New rate action.
155155
*/
156-
+ (id)actionWithAction:(CCActionInterval*)action rate:(float)rate;
156+
+ (id)actionWithAction:(CCActionInterval*)action rate:(CGFloat)rate;
157157

158158
/**
159159
* Initializes the action with the inner action and the rate parameter.
@@ -163,7 +163,7 @@
163163
*
164164
* @return New rate action.
165165
*/
166-
- (id)initWithAction:(CCActionInterval*)action rate:(float)rate;
166+
- (id)initWithAction:(CCActionInterval*)action rate:(CGFloat)rate;
167167

168168
@end
169169

@@ -196,34 +196,34 @@
196196
* CCActionEaseElastic adds a period property and applies a dampened oscillation to the specified action.
197197
*/
198198
@interface CCActionEaseElastic : CCActionEase <NSCopying> {
199-
float _period;
199+
CGFloat _period;
200200
}
201201

202202
// purposefully undocumented: little need to change period while action is running
203203
/* Period of the wave in radians. Default is 0.3. */
204-
@property (nonatomic,readwrite) float period;
204+
@property (nonatomic,readwrite) CGFloat period;
205205

206206
/** @name Creating an Ease Action */
207207

208208
/**
209209
* Creates the action with the inner action and the period in radians (default is 0.3).
210210
*
211211
* @param action Action to apply ease action to.
212-
* @param period eriod of wave in radians.
212+
* @param period period of wave in radians.
213213
*
214214
* @return New elastic action.
215215
*/
216-
+ (id)actionWithAction:(CCActionInterval*)action period:(float)period;
216+
+ (id)actionWithAction:(CCActionInterval*)action period:(CGFloat)period;
217217

218218
/**
219219
* Initializes the action with the inner action and the period in radians (default is 0.3).
220220
*
221221
* @param action Action to apply ease action to.
222-
* @param period eriod of wave in radians.
222+
* @param period period of wave in radians.
223223
*
224224
* @return New elastic action.
225225
*/
226-
- (id)initWithAction:(CCActionInterval*)action period:(float)period;
226+
- (id)initWithAction:(CCActionInterval*)action period:(CGFloat)period;
227227

228228
@end
229229

cocos2d/CCActionEase.m

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
#import "CCActionEase.h"
3737

3838
#ifndef M_PI_X_2
39-
#define M_PI_X_2 (float)M_PI * 2.0f
39+
#define M_PI_X_2 M_PI * 2.0
4040
#endif
4141

4242
#pragma mark EaseAction
@@ -98,7 +98,7 @@ -(CCActionInterval*) reverse
9898
@implementation CCActionEaseSineIn
9999
-(void) update: (CCTime) t
100100
{
101-
[_inner update:-1*cosf(t * (float)M_PI_2) +1];
101+
[_inner update:-1*cosf(t * M_PI_2) +1];
102102
}
103103

104104
- (CCActionInterval*) reverse
@@ -113,7 +113,7 @@ - (CCActionInterval*) reverse
113113
@implementation CCActionEaseSineOut
114114
-(void) update: (CCTime) t
115115
{
116-
[_inner update:sinf(t * (float)M_PI_2)];
116+
[_inner update:sinf(t * M_PI_2)];
117117
}
118118

119119
- (CCActionInterval*) reverse
@@ -128,7 +128,7 @@ - (CCActionInterval*) reverse
128128
@implementation CCActionEaseSineInOut
129129
-(void) update: (CCTime) t
130130
{
131-
[_inner update:-0.5f*(cosf( (float)M_PI*t) - 1)];
131+
[_inner update:-0.5*(cosf( M_PI*t) - 1)];
132132
}
133133
@end
134134

@@ -138,12 +138,12 @@ -(void) update: (CCTime) t
138138

139139
@implementation CCActionEaseRate
140140
@synthesize rate=_rate;
141-
+(instancetype) actionWithAction: (CCActionInterval*) action rate:(float)rate
141+
+(instancetype) actionWithAction: (CCActionInterval*) action rate:(CGFloat)rate
142142
{
143143
return [[self alloc] initWithAction: action rate:rate];
144144
}
145145

146-
-(id) initWithAction: (CCActionInterval*) action rate:(float)rate
146+
-(id) initWithAction: (CCActionInterval*) action rate:(CGFloat)rate
147147
{
148148
if( (self=[super initWithAction:action ]) )
149149
self.rate = rate;
@@ -176,7 +176,7 @@ -(void) update: (CCTime) t
176176
@implementation CCActionEaseOut
177177
-(void) update: (CCTime) t
178178
{
179-
[_inner update: 1.0f - powf(1.0f - t, _rate)];
179+
[_inner update: 1.0 - powf(1.0 - t, _rate)];
180180
}
181181
@end
182182

@@ -186,10 +186,10 @@ -(void) update: (CCTime) t
186186
{
187187
t *= 2;
188188
if (t < 1) {
189-
[_inner update: 0.5f * powf (t, _rate)];
189+
[_inner update: 0.5 * powf (t, _rate)];
190190
}
191191
else {
192-
[_inner update: 1.0f - 0.5f * powf(2-t, _rate)];
192+
[_inner update: 1.0 - 0.5 * powf(2-t, _rate)];
193193
}
194194
}
195195

@@ -211,20 +211,20 @@ @implementation CCActionEaseElastic
211211

212212
+(instancetype) actionWithAction: (CCActionInterval*) action
213213
{
214-
return [[self alloc] initWithAction:action period:0.3f];
214+
return [[self alloc] initWithAction:action period:0.3];
215215
}
216216

217-
+(instancetype) actionWithAction: (CCActionInterval*) action period:(float)period
217+
+(instancetype) actionWithAction: (CCActionInterval*) action period:(CGFloat)period
218218
{
219219
return [[self alloc] initWithAction:action period:period];
220220
}
221221

222222
-(id) initWithAction: (CCActionInterval*) action
223223
{
224-
return [self initWithAction:action period:0.3f];
224+
return [self initWithAction:action period:0.3];
225225
}
226226

227-
-(id) initWithAction: (CCActionInterval*) action period:(float)period
227+
-(id) initWithAction: (CCActionInterval*) action period:(CGFloat)period
228228
{
229229
if( (self=[super initWithAction:action]) )
230230
_period = period;
@@ -255,7 +255,7 @@ -(void) update: (CCTime) t
255255
newT = t;
256256

257257
else {
258-
float s = _period / 4;
258+
CGFloat s = _period / 4;
259259
t = t - 1;
260260
newT = -powf(2, 10 * t) * sinf( (t-s) *M_PI_X_2 / _period);
261261
}
@@ -279,7 +279,7 @@ -(void) update: (CCTime) t
279279
newT = t;
280280

281281
} else {
282-
float s = _period / 4;
282+
CGFloat s = _period / 4;
283283
newT = powf(2, -10 * t) * sinf( (t-s) *M_PI_X_2 / _period) + 1;
284284
}
285285
[_inner update:newT];
@@ -303,14 +303,14 @@ -(void) update: (CCTime) t
303303
else {
304304
t = t * 2;
305305
if(! _period )
306-
_period = 0.3f * 1.5f;
306+
_period = 0.3 * 1.5;
307307
CCTime s = _period / 4;
308308

309309
t = t -1;
310310
if( t < 0 )
311-
newT = -0.5f * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / _period);
311+
newT = -0.5 * powf(2, 10 * t) * sinf((t - s) * M_PI_X_2 / _period);
312312
else
313-
newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / _period) * 0.5f + 1;
313+
newT = powf(2, -10 * t) * sinf((t - s) * M_PI_X_2 / _period) * 0.5 + 1;
314314
}
315315
[_inner update:newT];
316316
}
@@ -330,19 +330,19 @@ @implementation CCActionEaseBounce
330330
-(CCTime) bounceTime:(CCTime) t
331331
{
332332
if (t < 1 / 2.75) {
333-
return 7.5625f * t * t;
333+
return 7.5625 * t * t;
334334
}
335335
else if (t < 2 / 2.75) {
336-
t -= 1.5f / 2.75f;
337-
return 7.5625f * t * t + 0.75f;
336+
t -= 1.5 / 2.75;
337+
return 7.5625 * t * t + 0.75;
338338
}
339339
else if (t < 2.5 / 2.75) {
340-
t -= 2.25f / 2.75f;
341-
return 7.5625f * t * t + 0.9375f;
340+
t -= 2.25 / 2.75;
341+
return 7.5625 * t * t + 0.9375;
342342
}
343343

344-
t -= 2.625f / 2.75f;
345-
return 7.5625f * t * t + 0.984375f;
344+
t -= 2.625 / 2.75;
345+
return 7.5625 * t * t + 0.984375;
346346
}
347347
@end
348348

@@ -397,9 +397,9 @@ -(void) update: (CCTime) t
397397
newT = t;
398398
else if (t < 0.5) {
399399
t = t * 2;
400-
newT = (1 - [self bounceTime:1-t] ) * 0.5f;
400+
newT = (1 - [self bounceTime:1-t] ) * 0.5;
401401
} else
402-
newT = [self bounceTime:t * 2 - 1] * 0.5f + 0.5f;
402+
newT = [self bounceTime:t * 2 - 1] * 0.5 + 0.5;
403403

404404
[_inner update:newT];
405405
}
@@ -413,7 +413,7 @@ @implementation CCActionEaseBackIn
413413

414414
-(void) update: (CCTime) t
415415
{
416-
CCTime overshoot = 1.70158f;
416+
CCTime overshoot = 1.70158;
417417
[_inner update: t * t * ((overshoot + 1) * t - overshoot)];
418418
}
419419

@@ -427,7 +427,7 @@ - (CCActionInterval*) reverse
427427
@implementation CCActionEaseBackOut
428428
-(void) update: (CCTime) t
429429
{
430-
CCTime overshoot = 1.70158f;
430+
CCTime overshoot = 1.70158;
431431

432432
t = t - 1;
433433
[_inner update: t * t * ((overshoot + 1) * t + overshoot) + 1];
@@ -444,7 +444,7 @@ @implementation CCActionEaseBackInOut
444444

445445
-(void) update: (CCTime) t
446446
{
447-
CCTime overshoot = 1.70158f * 1.525f;
447+
CCTime overshoot = 1.70158 * 1.525;
448448

449449
t = t * 2;
450450
if (t < 1)

0 commit comments

Comments
 (0)