@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow() .setFlags( WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON, WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); mGLSurfaceView = new CCGLSurfaceView(this); CCDirector director = CCDirector.sharedDirector(); director.attachInView(mGLSurfaceView); director.setDeviceOrientation(CCDirector.kCCDeviceOrientationLandscapeLeft); setContentView(mGLSurfaceView); // show FPS CCDirector.sharedDirector().setDisplayFPS(true); // frames per second CCDirector.sharedDirector().setAnimationInterval(1.0f / 60.0f); CCScene scene = CCScene.node(); scene.addChild(new Box2DTestLayer()); // Make the Scene active CCDirector.sharedDirector().runWithScene(scene); }
// not supported yet... public static final void CC_DIRECTOR_INIT(Activity app) { CCDirector director = CCDirector.sharedDirector(); director.setDeviceOrientation(CCDirector.kCCDeviceOrientationPortrait); director.setDisplayFPS(false); director.setAnimationInterval(1.0 / 60); CCGLSurfaceView sv = new CCGLSurfaceView(app); director.attachInView(sv); app.setContentView(sv); }
@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); }