public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    // SampleUIAnimation should create stencil buffer
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    return glSurfaceView;
  }
  public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    // B2SideScrollTest should create stencil buffer
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    return glSurfaceView;
  }
  public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    // CastleOfThorn should create stencil buffer
    glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);

    return glSurfaceView;
  }
  public Cocos2dxGLSurfaceView onCreateView() {
    Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this);
    // this line is need on some device if we specify an alpha bits
    if (this.mGLContextAttrs[3] > 0) glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);

    Cocos2dxEGLConfigChooser chooser = new Cocos2dxEGLConfigChooser(this.mGLContextAttrs);
    glSurfaceView.setEGLConfigChooser(chooser);

    return glSurfaceView;
  }
Esempio n. 5
0
 @Override
 protected void onPause() {
   Log.d(TAG, "onPause()");
   super.onPause();
   Cocos2dxHelper.onPause();
   mGLSurfaceView.onPause();
 }
Esempio n. 6
0
 private void resumeIfHasFocus() {
   if (hasFocus) {
     this.hideVirtualButton();
     Cocos2dxHelper.onResume();
     mGLSurfaceView.onResume();
   }
 }
Esempio n. 7
0
 public static void queueAccelerometer(
     final float x, final float y, final float z, final long timestamp) {
   sGLSurfaceView.queueEvent(
       new Runnable() {
         @Override
         public void run() {
           Cocos2dxAccelerometer.onSensorChanged(x, y, z, timestamp);
         }
       });
 }
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String packageName = getApplication().getPackageName();
    super.setPackageName(packageName);

    setContentView(R.layout.activity_main);
    mGLView = (Cocos2dxGLSurfaceView) findViewById(R.id.game_gl_surfaceview);
    mGLView.setTextField((EditText) findViewById(R.id.textField));
  }
Esempio n. 9
0
    @Override
    public void handleMessage(Message msg) {
      switch (msg.what) {
        case HANDLER_OPEN_IME_KEYBOARD:
          if (null != sGLSurfaceView.mCocosEditText
              && sGLSurfaceView.mCocosEditText.requestFocus()) {
            sGLSurfaceView.mCocosEditText.removeTextChangedListener(
                Cocos2dxGLSurfaceView.sTextInputWrapper);
            sGLSurfaceView.mCocosEditText.setText("");
            final String text = (String) msg.obj;
            sGLSurfaceView.mCocosEditText.append(text);
            Cocos2dxGLSurfaceView.sTextInputWrapper.setOriginText(text);
            sGLSurfaceView.mCocosEditText.addTextChangedListener(
                Cocos2dxGLSurfaceView.sTextInputWrapper);

            InputMethodManager imm =
                (InputMethodManager)
                    Cocos2dxActivity.COCOS_ACTIVITY.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.showSoftInput(sGLSurfaceView.mCocosEditText, 0);
            Log.d(TAG, "showSoftInput");
          }
          break;

        case HANDLER_CLOSE_IME_KEYBOARD:
          if (null != sGLSurfaceView.mCocosEditText) {
            sGLSurfaceView.mCocosEditText.removeTextChangedListener(
                Cocos2dxGLSurfaceView.sTextInputWrapper);
            InputMethodManager imm =
                (InputMethodManager)
                    Cocos2dxActivity.COCOS_ACTIVITY.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.hideSoftInputFromWindow(sGLSurfaceView.mCocosEditText.getWindowToken(), 0);
            sGLSurfaceView.requestFocus();
            Log.d(TAG, "HideSoftInput");
          }
          break;
      }
    }
Esempio n. 10
0
 public static void openIMEKeyboard() {
   Message msg = Message.obtain();
   msg.what = HANDLER_OPEN_IME_KEYBOARD;
   msg.obj = sGLSurfaceView.getContentText();
   sIMEHandler.sendMessage(msg);
 }
 @Override
 protected void onResume() {
   super.onResume();
   mGLView.onResume();
 }
 @Override
 protected void onPause() {
   super.onPause();
   mGLView.onPause();
 }