axmol/plugin/samples/HelloAds/Classes/HelloWorldScene.h

50 lines
1.4 KiB
C++

#ifndef __HELLOWORLD_SCENE_H__
#define __HELLOWORLD_SCENE_H__
#include "cocos2d.h"
#include "AdsAdmob.h"
class MyAdsListener : public cocos2d::plugin::AdsListener
{
public:
virtual void onAdsResult(cocos2d::plugin::AdsResultCode code, const char* msg);
virtual void onPlayerGetPoints(int points, cocos2d::plugin::ProtocolAds* pAdsPlugin);
};
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);
void testShow(CCObject* pSender);
void testHide(CCObject* pSender);
// option changed callback
void caseChanged(CCObject* pSender);
void posChanged(CCObject* pSender);
void typeChanged(CCObject* pSender);
// implement the "static node()" method manually
CREATE_FUNC(HelloWorld);
private:
cocos2d::plugin::AdsAdmob* m_pAdmob;
MyAdsListener* m_pListener;
cocos2d::CCMenuItemToggle* m_pCaseItem;
cocos2d::CCMenuItemToggle* m_pTypeItem;
cocos2d::CCMenuItemToggle* m_pPosItem;
cocos2d::plugin::ProtocolAds* m_pAds;
cocos2d::plugin::ProtocolAds::AdsPos m_ePos;
cocos2d::plugin::ProtocolAds::AdsType m_eType;
};
#endif // __HELLOWORLD_SCENE_H__