cocos2dx android 程序启动黑屏相关



http://blog.csdn.net/maximuszhou/article/details/39448971?utm_source=tuicool&utm_medium=referral
0.Cocos2d-x程序在Android下的启动过程

http://www.linuxidc.com/Linux/2011-09/42863.htm

1.在最初加载一张图片,可视为lauching
proj.android\res\drawable\lauching.png
proj.android\src\org\cocos2dx\lib\Cocos2dxActivity.java
public void init(){
 ... ...
 ImageView tImageView=new ImageView(this);  
 tImageView.setScaleType(ScaleType.CENTER);
  Drawable tDrawable=this.getResources().getDrawable(R.drawable.lauching);
  tImageView.setImageDrawable(tDrawable);
  mFrameLayout.addView(tImageView);
}

http://blog.sina.com.cn/s/blog_6957e2e50101bxf1.html
http://www.2cto.com/kf/201502/375356.html
2.将程序背景变透明(如果不删除的话,顶部会有一个Cocos2dxEditText的白条,Cocos2dxEditText封装了EditText,主要用于TextField,如果程序中有使用到它,那建议更换为EditBox)
proj.android\src\org\cocos2dx\lib\Cocos2dxActivity.java
public void init(){
 ... ...
    //Cocos2dxEditText edittext = new Cocos2dxEditText(this);
    //edittext.setLayoutParams(edittext_layout_params);
    //mFrameLayout.addView(edittext);
  //this.mGLSurfaceView.setCocos2dxEditText(edittext);
 this.mGLSurfaceView.setZOrderOnTop(true);
 this.mGLSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
}
proj.android\src\org\cocos2dx\lib\Cocos2dxRenderer.java
public void onSurfaceCreated(final GL10 pGL10, final EGLConfig pEGLConfig) {
 ... ...
 pGL10.glDisable(GL10.GL_DITHER);
 pGL10.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
 pGL10.glClearColor(0, 0, 0, 0);
 pGL10.glEnable(GL10.GL_CULL_FACE);
 pGL10.glShadeModel(GL10.GL_SMOOTH);
 pGL10.glEnable(GL10.GL_DEPTH_TEST);
}
proj.android\AndroidManifest.xml
    android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen"
     ... >




你可能感兴趣的:(cocos2dx android 程序启动黑屏相关)