資源簡介
高仿超級馬里奧,求下載!
代碼片段和文件信息
//
//??button.m
//??Classroom?Demo
//
//??Created?by?Nick?Pannuto?on?2/10/10.
//??Copyright?2010?Sneakyness?llc..?All?rights?reserved.
//
#import?“SneakyButton.h“
@implementation?SneakyButton
@synthesize?status?value?active?isHoldable?isToggleable?rateLimit?radius;
-(void)?onEnterTransitionDidFinish
{
#ifdef?__CC_PLATFORM_IOS
????CCLOG(@“iOS?SneakyInput“);
????CCDirector?*director?=??(CCDirector*)[CCDirector?sharedDirector];
????[[director?touchDispatcher]?removeDelegate:self];
[[director?touchDispatcher]?addTargetedDelegate:self?priority:1??swallowsTouches:YES];
#elif?defined?(__CC_PLATFORM_MAC)
????CCLOG(@“Mac?SneakyInput“);
????[[[CCDirector?sharedDirector]?eventDispatcher]?removeMouseDelegate:self];
????[[[CCDirector?sharedDirector]?eventDispatcher]?addMouseDelegate:self?priority:1];
#endif
????
????//CMLog(@“...%s...“?__PRETTY_FUNCTION__);
[super?onEnterTransitionDidFinish];
}
-?(void)onExit
{
#ifdef?__CC_PLATFORM_IOS
????CCDirector?*director?=??(CCDirector*)[CCDirector?sharedDirector];
[[director?touchDispatcher]?removeDelegate:self];
#elif?defined?(__CC_PLATFORM_MAC)
????[[[CCDirector?sharedDirector]?eventDispatcher]?removeMouseDelegate:self];
#endif
[super?onExit];
}
-(id)initWithRect:(CGRect)rect{
self?=?[super?init];
if(self){
bounds?=?CGRectMake(0?0?rect.size.width?rect.size.height);
center?=?CGPointMake(rect.size.width/2?rect.size.height/2);
status?=?1;?//defaults?to?enabled
active?=?NO;
value?=?0;
isHoldable?=?0;
isToggleable?=?0;
radius?=?32.0f;
rateLimit?=?1.0f/120.0f;
position_?=?rect.origin;
}
return?self;
}
-(void)limiter:(float)delta{
value?=?0;
[self?unschedule:?@selector(limiter:)];
active?=?NO;
}
-?(void)?setRadius:(float)r
{
radius?=?r;
radiusSq?=?r*r;
}
#pragma?mark?Touch?Delegate
#ifdef?__CC_PLATFORM_IOS
-?(BOOL)ccTouchBegan:(UITouch?*)touch?withEvent:(UIEvent?*)event
{
if?(active)?return?NO;
CGPoint?location?=?[[CCDirector?sharedDirector]?convertToGL:[touch?locationInView:[touch?view]]];
location?=?[self?convertToNodeSpace:location];
????//Do?a?fast?rect?check?before?doing?a?circle?hit?check:
if(location.x?-radius?||?location.x?>?radius?||?location.y?-radius?||?location.y?>?radius){
return?NO;
}else{
float?dSq?=?location.x*location.x?+?location.y*location.y;
if(radiusSq?>?dSq){
active?=?YES;
if?(!isHoldable?&&?!isToggleable){
value?=?1;
[self?schedule:?@selector(limiter:)?interval:rateLimit];
}
if?(isHoldable)?value?=?1;
if?(isToggleable)?value?=?!value;
return?YES;
}
}
????return?NO;
}
-?(void)ccTouchMoved:(UITouch?*)touch?withEvent:(UIEvent?*)event
{
if?(!active)?return;
CGPoint?location?=?[[CCDirector?sharedDirector]?convertToGL:[touch?locationInView:[touch?view]]];
location?=?[self?convertToNodeSpace:location];
????//Do?a?fast?rect?check?before?doing?a?circle?hit?check:
if(location.x?-radius?||?location.x?>?radius?||?location.y?-radius?||?location.y?>?radius){
return;
}else{
float?dSq?=?location.x
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-08-26?15:30??Model.xcdatamodeld\
?????文件?????????258??2017-07-05?07:02??Model.xcdatamodeld\.xccurrentversion
?????目錄???????????0??2020-08-26?15:30??Model.xcdatamodeld\Model.xcdatamodel\
?????文件?????????581??2017-07-05?07:02??Model.xcdatamodeld\Model.xcdatamodel\contents
?????文件?????????991??2017-07-05?07:02??SneakyButton.h
?????文件????????5173??2017-07-05?07:02??SneakyButton.m
?????文件?????????656??2017-07-05?07:02??SneakyButtonSkinnedba
?????文件????????2712??2017-07-05?07:02??SneakyButtonSkinnedba
?????文件????????1806??2017-07-05?07:02??SneakyJoystick.h
?????文件????????6241??2017-07-05?07:02??SneakyJoystick.m
?????文件?????????536??2017-07-05?07:02??SneakyJoystickSkinnedba
?????文件????????1830??2017-07-05?07:02??SneakyJoystickSkinnedba
?????目錄???????????0??2020-08-26?15:30??SuperMario\
?????文件????????2633??2017-07-05?07:02??SuperMario\AppDelegate.h
?????文件???????10858??2017-07-05?07:02??SuperMario\AppDelegate.mm
?????文件????????4031??2017-07-05?07:02??SuperMario\DownWorldla
?????文件??????112859??2017-07-05?07:02??SuperMario\DownWorldla
?????文件????????2279??2017-07-05?07:02??SuperMario\GLES-Render.h
?????文件????????7291??2017-07-05?07:02??SuperMario\GLES-Render.mm
?????文件????????2576??2017-07-05?07:02??SuperMario\GameConfig.h
?????文件?????????553??2017-07-05?07:02??SuperMario\GameInfola
?????文件????????6795??2017-07-05?07:02??SuperMario\GameInfola
?????文件????????1191??2017-07-05?07:02??SuperMario\Gameob
?????文件????????3166??2017-07-05?07:02??SuperMario\Gameob
?????文件????????1508??2017-07-05?07:02??SuperMario\HudStickla
?????文件???????12499??2017-07-05?07:02??SuperMario\HudStickla
?????文件?????????396??2017-07-05?07:02??SuperMario\Introla
?????文件????????2607??2017-07-05?07:02??SuperMario\Introla
?????文件?????????379??2017-07-05?07:02??SuperMario\Level.h
?????文件????????4660??2017-07-05?07:02??SuperMario\Level.mm
?????文件????????4359??2017-07-05?07:02??SuperMario\MainGamela
............此處省略413個文件信息
- 上一篇:ntpclient的實現源代碼
- 下一篇:基于等高線的三維地形建模
評論
共有 條評論