2013-04-19 16:19:04 +08:00
|
|
|
#ifndef __HELLOWORLD_SCENE_H__
|
|
|
|
#define __HELLOWORLD_SCENE_H__
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
2013-04-22 11:17:31 +08:00
|
|
|
#include "AdsAdmob.h"
|
|
|
|
|
|
|
|
class MyAdListener : public cocos2d::plugin::AdListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
virtual void onReceiveAd();
|
|
|
|
virtual void onPresentScreen();
|
|
|
|
virtual void onFailedToReceiveAd(EAdErrorCode code, const char* msg);
|
|
|
|
virtual void onDismissScreen();
|
|
|
|
};
|
2013-04-19 16:19:04 +08:00
|
|
|
|
|
|
|
class HelloWorld : public cocos2d::CCLayer
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// Here's a difference. Method 'init' in cocos2d-x returns bool, instead of returning 'id' in cocos2d-iphone
|
|
|
|
virtual bool init();
|
|
|
|
|
|
|
|
// there's no 'id' in cpp, so we recommend returning the class instance pointer
|
|
|
|
static cocos2d::CCScene* scene();
|
|
|
|
|
|
|
|
// a selector callback
|
|
|
|
void menuCloseCallback(CCObject* pSender);
|
2013-04-22 11:17:31 +08:00
|
|
|
void testShow(CCObject* pSender);
|
|
|
|
void testHide(CCObject* pSender);
|
|
|
|
|
|
|
|
// option changed callback
|
|
|
|
void caseChanged(CCObject* pSender);
|
|
|
|
void posChanged(CCObject* pSender);
|
|
|
|
|
2013-04-19 16:19:04 +08:00
|
|
|
// implement the "static node()" method manually
|
|
|
|
CREATE_FUNC(HelloWorld);
|
2013-04-22 11:17:31 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
cocos2d::plugin::AdsAdmob* m_pAdmob;
|
|
|
|
MyAdListener* m_pListener;
|
|
|
|
|
|
|
|
cocos2d::CCMenuItemToggle* m_pCaseItem;
|
|
|
|
cocos2d::CCMenuItemToggle* m_pPosItem;
|
|
|
|
cocos2d::plugin::ProtocolAds* m_pAds;
|
|
|
|
cocos2d::plugin::ProtocolAds::EBannerPos m_ePos;
|
2013-04-19 16:19:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __HELLOWORLD_SCENE_H__
|