Skip to content

Commit cdc50bd

Browse files
committed
Replaced legacy 'float' with CGFloat where appropriate.
1 parent e6b231c commit cdc50bd

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

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: 10 additions & 10 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.0
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.5*(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;
@@ -214,7 +214,7 @@ +(instancetype) actionWithAction: (CCActionInterval*) action
214214
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
}
@@ -224,7 +224,7 @@ -(id) initWithAction: (CCActionInterval*) action
224224
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];

0 commit comments

Comments
 (0)