@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); CCGLSurfaceView surfaceView = new CCGLSurfaceView(this); setContentView(surfaceView); director = CCDirector.sharedDirector(); director.attachInView(surfaceView); // ¿ªÆôÏß³Ì director.setDeviceOrientation(CCDirector.kCCDeviceOrientationLandscapeLeft); director.setDisplayFPS(true); director.setScreenSize(480, 320); CCScene ccScene = CCScene.node(); ccScene.addChild(new WelcomLayer()); director.runWithScene(ccScene); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); ccglSurfaceView = new CCGLSurfaceView(this); setContentView(ccglSurfaceView); // 导演(单列模式) ccDirector = CCDirector.sharedDirector(); // 开启线程 ccDirector.attachInView(ccglSurfaceView); // 设置方向 ccDirector.setDeviceOrientation(CCDirector.kCCDeviceOrientationLandscapeLeft); // 设置屏幕分辨率(自动适配) ccDirector.setScreenSize(480, 320); // 显示当前游戏的帧率 30 ccDirector.setDisplayFPS(true); // 创建场景 ccScene = CCScene.node(); // 添加图层 ccScene.addChild(new MapLayer()); // 导演运行场景 ccDirector.runWithScene(ccScene); }