2015년 8월 20일 목요일

cocos2d-x 3.6 multi resolution & hide softkey

Appdelete.cpp
bool AppDelegate::applicationDidFinishLaunching() 
{
    // initialize director
    auto director = Director::getInstance();
    auto glview = director->getOpenGLView();
    if(!glview) {
        glview = GLViewImpl::create("gajah");
        director->setOpenGLView(glview);
    }
    auto fs = glview->getFrameSize();
 glview->setDesignResolutionSize(fs.width, fs.height, kResolutionShowAll);

 FileUtils::getInstance()->addSearchPath("ccs");//add path for datas

    // turn on display FPS
    //director->setDisplayStats(true);

    // set FPS. the default value is 1.0/60 if you don't call this
    director->setAnimationInterval(1.0 / 60);

    register_all_packages();

    // create a scene. it's an autorelease object
    auto scene = HelloWorld::createScene();

    // run
    director->runWithScene(scene);

    return true;
}

proj.android/src/org/cocos2dx/cpp/AppActivity.java

package org.cocos2dx.cpp;

import org.cocos2dx.lib.Cocos2dxActivity;
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;

import android.os.Build;
import android.os.Bundle;

public class AppActivity extends Cocos2dxActivity {
 private static Cocos2dxGLSurfaceView glSurfaceView;

 @Override
 protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);

 }
 
 public Cocos2dxGLSurfaceView onCreateView() {
  glSurfaceView = new Cocos2dxGLSurfaceView(this);

  // create stencil buffer
  glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8);
  this.uiHide();

  

  return glSurfaceView;
 }

 @Override
 public void onWindowFocusChanged(boolean hasFocus) {
  super.onWindowFocusChanged(hasFocus);
  if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
  {
   uiHide();
  }
 }
 
 private void uiHide() {
  if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
  {
   glSurfaceView.setSystemUiVisibility(
     Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_STABLE
     | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
     | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
     | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_HIDE_NAVIGATION
     | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_FULLSCREEN
     | Cocos2dxGLSurfaceView.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
  }
 }
}

in this code,

added on AppActivity.java

onCreateView() function added

댓글 없음:

댓글 쓰기

JIRA Plugin - ScriptRunner 소개 #2

관련 글 소개 #1:  https://pineoc.blogspot.com/2019/03/scriptrunner-1.html ScriptRunner 소개 #2 지난 글에서는 Behaviours를 보았고 다음 내용인 콘솔, 리스너 등을 ...