2013-04-26 17:18:17 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2012-2013 cocos2d-x.org
|
|
|
|
|
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2013-04-19 16:19:04 +08:00
|
|
|
#ifndef __HELLOWORLD_SCENE_H__
|
|
|
|
#define __HELLOWORLD_SCENE_H__
|
|
|
|
|
|
|
|
#include "cocos2d.h"
|
2013-05-27 14:40:08 +08:00
|
|
|
#include "ProtocolAds.h"
|
2013-04-22 11:17:31 +08:00
|
|
|
|
2013-04-26 17:16:06 +08:00
|
|
|
class MyAdsListener : public cocos2d::plugin::AdsListener
|
2013-04-22 11:17:31 +08:00
|
|
|
{
|
|
|
|
public:
|
2013-04-26 17:16:06 +08:00
|
|
|
virtual void onAdsResult(cocos2d::plugin::AdsResultCode code, const char* msg);
|
2013-04-27 11:32:12 +08:00
|
|
|
virtual void onPlayerGetPoints(cocos2d::plugin::ProtocolAds* pAdsPlugin, int points);
|
2013-04-22 11:17:31 +08:00
|
|
|
};
|
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-26 17:16:06 +08:00
|
|
|
void typeChanged(CCObject* pSender);
|
2013-04-22 11:17:31 +08:00
|
|
|
|
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:
|
2013-05-27 14:40:08 +08:00
|
|
|
cocos2d::plugin::ProtocolAds* m_pAdmob;
|
2013-04-26 17:16:06 +08:00
|
|
|
MyAdsListener* m_pListener;
|
2013-04-22 11:17:31 +08:00
|
|
|
|
|
|
|
cocos2d::CCMenuItemToggle* m_pCaseItem;
|
2013-04-26 17:16:06 +08:00
|
|
|
cocos2d::CCMenuItemToggle* m_pTypeItem;
|
2013-04-22 11:17:31 +08:00
|
|
|
cocos2d::CCMenuItemToggle* m_pPosItem;
|
2013-04-26 17:16:06 +08:00
|
|
|
|
2013-04-22 11:17:31 +08:00
|
|
|
cocos2d::plugin::ProtocolAds* m_pAds;
|
2013-04-26 17:16:06 +08:00
|
|
|
cocos2d::plugin::ProtocolAds::AdsPos m_ePos;
|
|
|
|
cocos2d::plugin::ProtocolAds::AdsType m_eType;
|
2013-04-19 16:19:04 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // __HELLOWORLD_SCENE_H__
|