Cocos2dx 3.16
Android Studio 3.0
Hello, I made a scene using the cocos2dx to creator c++ plugin and it loads fine on my LG G4 i can hear the music and buttons press in and out showing taps are felt. The issue is that my button will not do anything it reacts visibly but does not do the director end function i have tried various things and cannot figure out why my scene will not respond.
#include <reader/CreatorReader.h>
#include "MMScene.h"
#include "SimpleAudioEngine.h"
#include "ui/CocosGUI.h"
#include <ui/UILayout.h>
using namespace cocos2d;
USING_NS_CC;
Scene* MMScene::createScene()
{
creator::CreatorReader* reader = creator::CreatorReader::createWithFilename("creator/MDiceX/MMScene.ccreator");
// will create the needed spritesheets + design resolution
reader->setup();
// get the scene graph
Scene * MMScene = reader->getSceneGraph();
// ...and use it
Director::getInstance()->replaceScene(MMScene);
CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic("Music/achaidhcheide.mp3");
// return the scene
return MMScene;
}
// on "init" you need to initialize your instance
bool MMScene::init() {
//////////////////////////////
// 1. super init first
if (!Scene::init()) {
return false;
}
auto FirstStartUp = ( ui::Layout * )this->getChildByName("FirstStartUp" );
FirstStartUp->setTouchEnabled(false);
FirstStartUp->setSwallowTouches(false);
FirstStartUp->setVisible(false);
FirstStartUp->setEnabled(false);
auto MMLeaderBoardButton = ( ui::Button * )this->getChildByName("MMLeaderBoardButton" );
MMLeaderBoardButton->addTouchEventListener([&](Ref* sender, Widget::TouchEventType type){
switch (type)
{
case ui::Widget::TouchEventType::BEGAN:
break;
case ui::Widget::TouchEventType::ENDED:
Director::getInstance()->end();
break;
default:
break;
}
});
this->addChild(MMLeaderBoardButton);
auto visibleSize = Director::getInstance()->getVisibleSize();
Vec2 origin = Director::getInstance()->getVisibleOrigin();
}