Created
September 12, 2012 20:11
-
-
Save quantumpotato/3709551 to your computer and use it in GitHub Desktop.
Avoiding multiple #import .h when using @Class forward declaration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//QPBattlefield.h | |
#import "ClonePilotBattlefield.h" | |
#import "QPBFState.h" | |
#import "QPBFTitleState.h" | |
#import "QPBFDrawingState.h" | |
#import "QPBFInputConstants.h" | |
@interface QPBattlefield : ClonePilotBattlefield | |
@property (nonatomic, retain) QPBFState *currentState; | |
@property (nonatomic, retain) QPBFTitleState *titleState; | |
@property (nonatomic, retain) QPBFDrawingState *drawingState; | |
- (void)changeState:(QPBFState *)state; | |
@end | |
//QPBFState.h | |
#import <Foundation/Foundation.h> | |
@class QPBattlefield; | |
@interface QPBFState : NSObject | |
@property (nonatomic, retain) QPBattlefield *f; | |
- (void)addTouch:(CGPoint)l; | |
- (id)initWithBattlefield:(QPBattlefield *)field; | |
@end | |
//QPBFTitleState.m ((inherits from QPBFState)) | |
#import "QPBFTitleState.h" | |
#import "QPBattlefield.h" | |
@implementation QPBFTitleState | |
- (void)addTouch:(CGPoint)l { | |
if (GetDistance(l, self.f.player.l) <= QPBF_PLAYER_TAP_RANGE) { | |
[self.f changeState:self.f.drawingState]; | |
} | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can put it in your PCH file maybe.