1
我想在iPhone上顯示粒子效果。 該應用程序是通用應用程序。我已經在iPad上測試過該應用,所以粒子效果在iPad上正常運行。但它不會出現在iPhone上。對iPhone屏幕沒有影響。爲什麼不在iPhone上使用粒子效果?
我無法找到它不起作用的原因。
@interface MenuSceneController : UIViewController <AVAudioPlayerDelegate>
{
EAGLView *mParticle;
};
- (void)addParticle
{
mParticle = [[EAGLView alloc] initWithFrame:CGRectMake(335, 200, 1024, 768) andFileName:@"particle.pex"];
mParticle.alpha = 0.99;
mParticle.userInteractionEnabled = NO;
[self.view addSubview:mParticle];
[mParticle startAnimation];
}
- (id)initWithFrame:(CGRect)_frame andFileName:(NSString *)_filename
{
if ((self = [super initWithFrame:_frame]))
{
// Get the layer
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.opaque = NO;
eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:FALSE],
kEAGLDrawablePropertyRetainedBacking,
kEAGLColorFormatRGBA8,
kEAGLDrawablePropertyColorFormat,
nil];
renderer = [[ES1Renderer alloc] initWithParticleFileName:_filename];
if (!renderer)
{
[self release];
return nil;
}
animating = FALSE;
displayLinkSupported = TRUE;
animationFrameInterval = 1;
displayLink = nil;
animationTimer = nil;
NSString *reqSysVer = @"3.1";
NSString *currSysVer = [[UIDevice currentDevice] systemVersion];
if ([currSysVer compare:reqSysVer options:NSNumericSearch] != NSOrderedAscending)
displayLinkSupported = TRUE;
}
return self;
}
「particle.pex」文件是粒子效果文件。
請幫幫我。 謝謝。
謝謝,所以我調整iPhone的屏幕大小。但它不起作用。 – jinbruce627
Hi,LearnCocos2D,您如何看待.pex文件? – jinbruce627