【问题标题】:why doesn't the Particle Effect work on iPhone?为什么粒子效果在 iPhone 上不起作用?
【发布时间】:2011-11-07 08:54:07
【问题描述】:

我正在尝试在 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”文件为粒子效果文件。

请帮助我。 谢谢。

【问题讨论】:

    标签: iphone ipad cocos2d-iphone


    【解决方案1】:

    可能是因为您没有将屏幕尺寸调整为 iPhone 的尺寸?

    CGRectMake(335, 200, 1024, 768)
    

    【讨论】:

    • 谢谢,所以我调整了 iPhone 的屏幕尺寸。但它不起作用。
    • 嗨,LearnCocos2D,你觉得 .pex 文件怎么样?
    猜你喜欢
    • 1970-01-01
    • 2010-10-17
    • 1970-01-01
    • 1970-01-01
    • 2021-04-07
    • 1970-01-01
    • 1970-01-01
    • 2014-04-28
    相关资源
    最近更新 更多