Im using cocos2d-x v4.0
is “setTouchEnabled and setTouchMode” been removed?
Here’s my code:
bool Joystick::init()
{
if (!Layer::init())
return false;
_winSize = Director::getInstance()->getWinSize();
_isTouch = false;
// speed
_speed = 0.1;
// touch show
_isTouchShow = false;
// limit win size
_isLimmitWinSize = false;
// Joystick - Standard Position
centerPos = Vec2(125, 125);
// Joystick - Back Sprite (Limit)
joystick_limit = Sprite::create("joystick_limit_circle.png");
joystick_limit->setPosition(centerPos);
this->addChild(joystick_limit);
// Joystick - Front Sprite (Controler)
joystick_control = Sprite::create("joystick_control_circle.png");
joystick_control->setPosition(centerPos);
this->addChild(joystick_control);
// Joystick - Controler Position
controlerPos = centerPos;
// Touch Enabled
this->setTouchEnabled(true);
this->setTouchMode(Touch::DispatchMode::ALL_AT_ONCE);
// setSchedule Update
cocos2d::Director::getInstance()->getScheduler()->schedule(
std::bind(&Joystick::update, this, std::placeholders::_1),
this, 1 / 60.f, false, "JoyStickUpdate");
return true;
}
if its been removed what should i use instead of setTouchEnable and setTouchMode???