1
public EngineOptions onCreateEngineOptions() {
    instance = this;
    mCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);

    return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera)).setNeedsSounds(true);
}

启用声音时显示错误它显示错误该方法 setNeedsSound(boolean) 未定义类型 EngineOptions

也试过

return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
                new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera)).getAudioOptions().setNeedsSound(true);

但显示错误 Type mismatch: cannot convert from AudioOptions to EngineOptions

4

2 回答 2

0

试试这种方式

final EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED,
            new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera);
    engineOptions.getAudioOptions().setNeedsSound(true);
    engineOptions.getAudioOptions().setNeedsMusic(true);
于 2012-09-27T12:44:00.323 回答
0

您的代码中似乎有额外)的内容。尝试:

return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), mCamera).setNeedsSounds(true);
于 2012-09-27T12:46:12.763 回答