Can I get sneakyness / SneakyInput project in c++ for use in cocos2d-x .

Hello all,

I have recently gone through a book and it uses sneakyness / SneakyInput classes whose github repository is at : https://github.com/sneakyness/SneakyInput . The Project is in Objective-c but I want it for use in cocos2d-x . Is there any such library I can use with cocos2d-x or I need to modify it by myself.

Any way thanks for your support.

If you want to use them only on iOS, just wrap the objc interfaces into C++, then call them in cocos2d-x games.

No I am working on windows using visual c++ and I can’t do that.

Oops, then you need to translate the whole sneakyness from objc to c++. It looks not a little workload.

There are several strange ports now (https://github.com/cpinan/SneakyInput-Cocos2dx-2.0.x - for example), but unfortunatelly all of them is totally unusable. I’ve started my own porting job, but I’m worried about a couple of moments. One of them:

- (void)informTargets {
    for (NSDictionary * targetData in _targets) {
        id target = [targetData objectForKey:@"target"];
        SEL action = NSSelectorFromString([targetData objectForKey:@"action"]);
        [target performSelector:action];
    }
}

Does anybody know a solution to convert such specific Obj-C code to C++? Is there is any build-in analogs in cocos2d-x? Any ideas are welcome :slight_smile:

I didn’t look into the source code yet. But It just crashes when I use SneakyInput-Cocos2dx-2.0.x:

fireButton = new SneakyButton();
fireButton~~>initWithRect;
fireButton~~>setIsHoldable(true);

It crashes when I setIsHoldable (actually it crashes when I call any set function)

Hi,

is this still the case? Is there a more recent port of SneakyInput for cocos2d-x v3.0 ?

I would rather have a strong C++ control framework on the Cocos2d-x v3.0 roadmap than another hokey port of an old Objective-C library.