为什么粒子效果不能在iPhone上运行?

时间:2011-11-07 08:54:08

标签: iphone ipad cocos2d-iphone

我试图在iPhone上显示粒子效果。 该应用程序是通用应用程序我已经在iPad上测试了应用程序,因此粒子效果在iPad上正常运行。但它不会出现在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”文件是粒子效果文件。

请帮帮我。 感谢。

1 个答案:

答案 0 :(得分:0)

也许那是因为您没有将屏幕尺寸调整为iPhone的尺寸?

CGRectMake(335, 200, 1024, 768)