【cocos2d-x入門實戰】微信飛機大戰之十五:跨平台移植和廣告植入

來源:互聯網
上載者:User


配置方式建立請看上文。

    if (!CCDirector::sharedDirector()->getOpenGLView())    {        CCEGLView *view = &CCEGLView::sharedOpenGLView();        view->setFrameSize(w, h);        // set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.         view->setDesignResolutionSize(480, 800);//加入這一句,目的就是為了適配螢幕        AppDelegate *pAppDelegate = new AppDelegate();        CCApplication::sharedApplication().run();    }

LOCAL_SRC_FILES := helloworld/main.cpp \                   ../../Classes/AppDelegate.cpp \   ../../Classes/BulletLayer.cpp \   ../../Classes/ControlLayer.cpp \   ../../Classes/Enemy1Layer.cpp \   ../../Classes/Enemy2Layer.cpp \   ../../Classes/Enemy3Layer.cpp \   ../../Classes/GameLayer.cpp \   ../../Classes/GameScene.cpp \   ../../Classes/PlaneLayer.cpp \   ../../Classes/WelcomeLayer.cpp \   ../../Classes/WelcomeScene.cpp \   ../../Classes/Enemy1Sprite.cpp \   ../../Classes/Enemy2Sprite.cpp \   ../../Classes/Enemy3Sprite.cpp \   ../../Classes/UFOLayer.cpp \   ../../Classes/GameOverLayer.cpp \   ../../Classes/GameOverScene.cpp \   ../../Classes/MutiBulletsLayer.cpp 

public class JackyAirplane extends Cocos2dxActivity
public class Cocos2dxActivity extends Activity

Runnable runnable=new Runnable() {@Overridepublic void run() {// TODO Auto-generated method stubIntent intent = new Intent(LoadActivity.this, JackyAirplane.class);LoadActivity.this.startActivity(intent);//切換ActivityLoadActivity.this.finish();}};

public class JackyAirplane extends Cocos2dxActivity{...public static AdView adView;    // 第3方廣告}

public static void showAD() {   new Thread(new Runnable(){   @Override  public void run() {  adView.setVisibility( adView.VISIBLE );  }   }).start();}

#include <jni/JniHelper.h>JniMethodInfo minfo;  jobject jobj;   bool b = JniHelper::getStaticMethodInfo(minfo,   "com/jacky/jackyAirplane/JackyAirplane",  //類路徑"showAD",   //靜態方法名  "()V");   //括弧裡的是參數,後面的是返回值if(b)jobj = minfo.env->CallStaticObjectMethod(minfo.classID, minfo.methodID);  else;//列印錯誤...


相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.