Tag Info

New answers tagged

0

Most simple and reliable is to use the singular event "ccTouchBegan/ccTouchEnded" events, instead of the multiple one "ccTouchesBegan/ccTouchesEnded". Also, make sure you do this in a class that inherits from Layer/LayerColor, otherwise it won't work. virtual bool ccTouchBegan(cocos2d::Touch *pTouch, cocos2d::Event *pEvent); bool ...


0

This should work. class HelloWorld { public: typedef HelloWorld self; HelloWorld(); virtual ~HelloWorld(); virtual void onTouchesBegan(const vector<Touch*>& touches, Event* event); HelloWorld::HelloWorld() { auto listener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = ...


0

auto jumpListener = EventListenerTouchAllAtOnce::create(); listener->onTouchesBegan = CC_CALLBACK_2(HelloWorld::onTouchesBegan, this); void HelloWorld::onTouchesBegan(const std::vector<cocos2d::Touch *> &touches, cocos2d::Event * event) { CCLOG("MULTI TOUCH BEGAN"); } Try this


0

I created an drawing app for kids and I think the RenderTexture is the best solution for such applications. You can use visit() method of Sprite and draw(=visit) a point ( probably a circle sprite) on your canvas(=RenderTexture) while touch is moving(=onTouchMoved). Don't forget to call RenderTexture->begin()/end() when using visit function. This if ...


0

cocos2D-x 2.x and 3.x have very easy solution for multi-resolution problem ( either iDevices or Android devices) As you can see in Multi-resolution support document. In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution. If target device really has this resolution ( or any other with same ...


0

I need too often to show popup message in my games. so I've created a base class and I derived new popup message class from it and override SetupUI() in derived class to show my desired message. in fact you need to put a MenuItem in SetupUI() of new class to implement "ok" button simply. Note: CreateInvisibleBackgroundButton() works for cocos2dx v2.x and ...


1

There is no option about dp in cocos2dx and in fact we don't need it. But cocos2D-x 2.x and 3.x have very easy solution for multi-resolution problem ( either iDevices or Android devices) As you saw in Multi-resolution support document. In fact you just need to set your DesignResolution and then just imagine your target device will has this resolution. If ...



Top 50 recent answers are included