Skip to content

Commit 8b567c1

Browse files
s1ddoks1ddok
authored andcommitted
Remove android leftovers in CCTouch
1 parent 2943774 commit 8b567c1

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

cocos2d/CCTouch.h

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88

99
#import "ccMacros.h"
1010

11-
#if __CC_PLATFORM_IOS
1211
#import <UIKit/UIKit.h>
13-
#define PlatformTouch UITouch
14-
#else
15-
#define PlatformTouch NSObject
16-
#endif
1712

1813
@class CCGLView;
1914
@class CCNode;
@@ -63,10 +58,10 @@ typedef NS_ENUM (NSInteger, CCTouchPhase) {
6358
PlatformTouch is equivalent to UITouch on iOS and NSObject on OS X.
6459
@since v3.2 and later
6560
*/
66-
@property (nonatomic, strong) PlatformTouch* uiTouch;
61+
@property (nonatomic, strong) UITouch* uiTouch;
6762

68-
- (instancetype)initWithPlatformTouch:(PlatformTouch*)touch;
69-
+ (instancetype)touchWithPlatformTouch:(PlatformTouch*)touch;
63+
- (instancetype)initWithUITouch:(UITouch*)touch;
64+
+ (instancetype)touchWithUITouch:(UITouch*)touch;
7065

7166
/** @name Convert Touch Location to Node Coordinate System */
7267

cocos2d/CCTouch.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
@implementation CCTouch
1414

15-
- (instancetype)initWithPlatformTouch:(PlatformTouch*)touch
15+
- (instancetype)initWithUITouch:(UITouch*)touch
1616
{
1717
if((self = [super init]))
1818
{
@@ -24,7 +24,7 @@ - (instancetype)initWithPlatformTouch:(PlatformTouch*)touch
2424
return self;
2525
}
2626

27-
+ (instancetype)touchWithPlatformTouch:(PlatformTouch*)touch
27+
+ (instancetype)touchWithUITouch:(UITouch*)touch
2828
{
2929
return [[self alloc] initWithPlatformTouch:touch];
3030
}

cocos2d/CCTouchEvent.m

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ - (id)init
3131
_deadTouches = [[NSMutableSet alloc] init];
3232
for(int i = 0; i < 10; i++)
3333
{
34-
[_deadTouches addObject:[CCTouch touchWithPlatformTouch:nil]];
34+
[_deadTouches addObject:[CCTouch touchWithUITouch:nil]];
3535
}
3636

3737
_allTouches = [[NSMutableDictionary alloc] init];
@@ -47,7 +47,7 @@ - (void)updateTouchesBegan:(NSSet*)touches
4747
[_currentTouches removeAllObjects];
4848

4949
// Began touches - move touches from dead pool to allTouches
50-
for(PlatformTouch* touch in touches)
50+
for(UITouch* touch in touches)
5151
{
5252
CCTouch* ccTouch = [_deadTouches anyObject];
5353
ccTouch.uiTouch = touch;
@@ -58,7 +58,7 @@ - (void)updateTouchesBegan:(NSSet*)touches
5858
}
5959

6060
// Set currentTouches
61-
for(PlatformTouch* touch in touches)
61+
for(UITouch* touch in touches)
6262
{
6363
CCTouch* ccTouch = [_allTouches objectForKey:[NSValue valueWithNonretainedObject:touch]];
6464
if(ccTouch)
@@ -75,7 +75,7 @@ - (void)updateTouchesMoved:(NSSet*)touches
7575
[_currentTouches removeAllObjects];
7676

7777
// Set currentTouches
78-
for(PlatformTouch* touch in touches)
78+
for(UITouch* touch in touches)
7979
{
8080
CCTouch* ccTouch = [_allTouches objectForKey:[NSValue valueWithNonretainedObject:touch]];
8181
if(ccTouch)
@@ -94,7 +94,7 @@ - (void)updateTouchesEnded:(NSSet*)touches
9494
NSMutableArray* keys = [[NSMutableArray alloc] init];
9595

9696
// Set currentTouches
97-
for(PlatformTouch* touch in touches)
97+
for(UITouch* touch in touches)
9898
{
9999
CCTouch* ccTouch = [_allTouches objectForKey:[NSValue valueWithNonretainedObject:touch]];
100100
if(ccTouch)
@@ -109,7 +109,7 @@ - (void)updateTouchesEnded:(NSSet*)touches
109109

110110

111111
// Ended touches - remove touches from allTouches and place them back into the deadpool
112-
NSArray* deadTouches = [_allTouches objectsForKeys:keys notFoundMarker:[CCTouch touchWithPlatformTouch:nil]];
112+
NSArray* deadTouches = [_allTouches objectsForKeys:keys notFoundMarker:[CCTouch touchWithUITouch:nil]];
113113
[_deadTouches addObjectsFromArray:deadTouches];
114114
[_allTouches removeObjectsForKeys:keys];
115115
}
@@ -121,7 +121,7 @@ - (void)updateTouchesCancelled:(NSSet*)touches
121121
NSMutableArray* keys = [[NSMutableArray alloc] init];
122122

123123
// Set currentTouches
124-
for(PlatformTouch* touch in touches)
124+
for(UITouch* touch in touches)
125125
{
126126
CCTouch* ccTouch = [_allTouches objectForKey:[NSValue valueWithNonretainedObject:touch]];
127127
if(ccTouch)
@@ -136,7 +136,7 @@ - (void)updateTouchesCancelled:(NSSet*)touches
136136

137137

138138
// Ended touches - remove touches from allTouches and place them back into the deadpool
139-
NSArray* deadTouches = [_allTouches objectsForKeys:keys notFoundMarker:[CCTouch touchWithPlatformTouch:nil]];
139+
NSArray* deadTouches = [_allTouches objectsForKeys:keys notFoundMarker:[CCTouch touchWithUITouch:nil]];
140140
[_deadTouches addObjectsFromArray:deadTouches];
141141
[_allTouches removeObjectsForKeys:keys];
142142
}

cocos2d/Platforms/iOS/UITouch+CC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#import "cocos2d.h"
3232
#import <UIKit/UIKit.h>
3333

34-
@interface PlatformTouch (CC)
34+
@interface UITouch (CC)
3535

3636
- (CGPoint) locationInNode:(CCNode*) node;
3737
- (CGPoint) locationInWorld;

cocos2d/Platforms/iOS/UITouch+CC.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929

3030
#import "UITouch+CC.h"
3131

32-
@implementation PlatformTouch (CC)
32+
@implementation UITouch (CC)
3333

3434
- (CGPoint) locationInNode:(CCNode*) node
3535
{

0 commit comments

Comments
 (0)