资源简介

一群骷髅头在荒山上赛跑,界面通过各种特效来制造恐怖氛围,可以设置游戏参数、也可以显示排行榜

资源截图

代码片段和文件信息


#import “ColoredCircleSprite.h“

@interface ColoredCircleSprite (privateMethods)
- (void) updateContentSize;
- (void) updateColor;
@end


@implementation ColoredCircleSprite

@synthesize radius=radius_;
// Opacity and RGB color protocol
@synthesize opacity=opacity_ color=color_;
@synthesize blendFunc=blendFunc_;

+ (id) circleWithColor: (ccColor4B)color radius:(GLfloat)r
{
return [[[self alloc] initWithColor:color radius:r] autorelease];
}

- (id) initWithColor:(ccColor4B)color radius:(GLfloat)r
{
if( (self=[self init]) ) {
self.radius = r;

color_.r = color.r;
color_.g = color.g;
color_.b = color.b;
opacity_ = color.a;
}
return self;
}

- (void) dealloc
{
free(circleVertices_);
[super dealloc];
}

- (id) init
{
if((self = [super init])){
radius_ = 10.0f;
numberOfSegments = 36U;

// default blend function
blendFunc_ = (ccBlendFunc) { CC_BLEND_SRC CC_BLEND_DST };

color_.r =
color_.g =
color_.b = 0U;
opacity_ = 255U;

circleVertices_ = malloc(sizeof(GLfloat)*2*(numberOfSegments));
if(!circleVertices_){
NSLog(@“Ack!! malloc in colored circle failed“);
[self release];
return nil;
}
memset(circleVertices_ 0 sizeof(GLfloat)*2*(numberOfSegments));

self.radius = radius_;
}
return self;
}

-(void) setRadius: (float) size
{
radius_ = size;
const float theta_inc = 2.0f * 3.14159265359f/numberOfSegments;
float theta = 0.0f;

for(int i=0; i {
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
float j = radius_ * [[CCDirector sharedDirector] contentScaleFactor] * cosf(theta) + position_.x;
float k = radius_ * [[CCDirector sharedDirector] contentScaleFactor] * sinf(theta) + position_.y;
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
float j = radius_ * cosf(theta) + position_.x;
float k = radius_ * sinf(theta) + position_.y;
#endif

circleVertices_[i*2] = j;
circleVertices_[i*2+1] = k;

theta += theta_inc;
}

[self updateContentSize];
}

-(void) setContentSize: (CGSize) size
{
self.radius = size.width/2;
}

- (void) updateContentSize
{
[super setContentSize:CGSizeMake(radius_*2 radius_*2)];
}

- (void)draw
{
// Default GL states: GL_TEXTURE_2D GL_VERTEX_ARRAY GL_COLOR_ARRAY GL_TEXTURE_COORD_ARRAY
// Needed states: GL_VERTEX_ARRAY
// Unneeded states: GL_COLOR_ARRAY GL_TEXTURE_2D GL_TEXTURE_COORD_ARRAY
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);
glDisable(GL_TEXTURE_2D);

glVertexPointer(2 GL_FLOAT 0 circleVertices_);
glColor4f(color_.r/255.0f color_.g/255.0f color_.b/255.0f opacity_/255.0f);

BOOL newBlend = NO;
if( blendFunc_.src != CC_BLEND_SRC || blendFunc_.dst != CC_BLEND_DST ) {
newBlend = YES;
glBlendFunc(blendFunc_.src blendFunc_.dst);
}else if( opacity_ == 255 ) {
newBlend = YES;
glBlendFunc(GL_ONE GL_ZERO);
}else{
newBlend = YES;
glBlendFunc(GL_SRC_ALPHA GL_ONE_MINUS_SRC_ALPHA);
}

glDrawArrays(GL_TRIANGLE_FAN 0 numberOfSegments);

if( newB

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2012-11-16 16:55  Hills\
     文件       21508  2012-11-16 18:03  Hills\.DS_Store
     目录           0  2012-11-17 16:24  __MACOSX\
     目录           0  2012-11-17 16:24  __MACOSX\Hills\
     文件         222  2012-11-16 18:03  __MACOSX\Hills\._.DS_Store
     目录           0  2012-11-16 16:54  Hills\Classes\
     文件         593  2011-09-29 16:08  Hills\Classes\CDynaSprite.h
     目录           0  2012-11-17 16:24  __MACOSX\Hills\Classes\
     文件         273  2011-09-29 16:08  __MACOSX\Hills\Classes\._CDynaSprite.h
     文件         512  2011-10-13 18:37  Hills\Classes\CDynaSprite.mm
     文件         273  2011-10-13 18:37  __MACOSX\Hills\Classes\._CDynaSprite.mm
     文件         478  2011-11-03 02:25  Hills\Classes\Common.h
     文件         273  2011-11-03 02:25  __MACOSX\Hills\Classes\._Common.h
     文件        2190  2011-10-21 20:59  Hills\Classes\ComputerPlayer.h
     文件         273  2011-10-21 20:59  __MACOSX\Hills\Classes\._ComputerPlayer.h
     文件        5908  2011-11-03 01:31  Hills\Classes\ComputerPlayer.mm
     文件         273  2011-11-03 01:31  __MACOSX\Hills\Classes\._ComputerPlayer.mm
     文件         233  2011-10-24 00:12  Hills\Classes\Diffucultylayer.h
     文件         273  2011-10-24 00:12  __MACOSX\Hills\Classes\._Diffucultylayer.h
     文件        2282  2011-10-25 20:27  Hills\Classes\Diffucultylayer.mm
     文件         273  2011-10-25 20:27  __MACOSX\Hills\Classes\._Diffucultylayer.mm
     文件         269  2011-10-23 02:44  Hills\Classes\Floater.h
     文件         273  2011-10-23 02:44  __MACOSX\Hills\Classes\._Floater.h
     文件        2198  2011-10-23 03:14  Hills\Classes\Floater.mm
     文件         273  2011-10-23 03:14  __MACOSX\Hills\Classes\._Floater.mm
     文件         387  2011-10-25 20:44  Hills\Classes\Floater.plist
     文件         222  2011-10-25 20:44  __MACOSX\Hills\Classes\._Floater.plist
     文件         531  2011-10-04 06:02  Hills\Classes\GameConfig.h
     文件         273  2011-10-04 06:02  __MACOSX\Hills\Classes\._GameConfig.h
     文件        3165  2011-01-22 22:49  Hills\Classes\GameKitHelper.h
     文件         222  2011-01-22 22:49  __MACOSX\Hills\Classes\._GameKitHelper.h
............此处省略1251个文件信息

评论

共有 条评论