Gyroscope using Cocos2d-x - cocos2d-x

Does Cocos2d-x gives support for using gyroscope? And if it isn't, then how can i use it?

No. Cocos2d-x doesn't support gyroscope yet. Only accelerometer.

Yes, you can see the class CCAccelerometer. and in the testcpp sample, there is a AccelerometerTest

Yes, but you should enable it manually. You also can add a event listener that way :
Device::setAccelerometerEnabled(true);
Device::setAccelerometerInterval(1 / 30.0);
auto accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(GameplayLayer::onAcceleration, this));
_eventDispatcher->addEventListenerWithSceneGraphPriority(accelerationListener, this);

Related

AS3 AIR RequestSoftKeyboard not working on Windows

I tried to launch a virtual keyboard on Windows using this:
_txtInputName = new TextField();
_txtInputName.type = TextFieldType.INPUT;
_txtInputName.needsSoftKeyboard = true;
_txtInputName.addEventListener(FocusEvent.FOCUS_IN, onFocus );
private function onFocus(e:FocusEvent):void
{
_txtInputName.requestSoftKeyboard();
}
Unfortunaly, the softkeyboard doesn't show up. Am I missing something? Does I have to add something on the application.xml?
Thank you so much!
TextField is not an object type compatible with native keyboard handling. As a coder using a TextField does mean not using native keyboard at all. SO simple answer to your question is this:
Of course it's not working since it's not mean to.
Next: To provide native keyboard support on the AIR platform the StageText built-in class was implemented and is the one any coder wanting to handle native keyboard should use.
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/StageText.html

How to add touch event listener in Cocos2dx 3.1?

I used following code to add listener method to a Button in cocos2dx:
button->addTouchEventListener(this, toucheventselector(HomeScene::doSomething));
But since Cocos2dx 3.1 both toucheventselector and addTouchEventListener is depreciated. There is :
void addTouchEventListener(ccWidgetTouchCallback callback);
I can't make it work - I tried every macro I could find - callfuncO_selector, CC_CALLBACK etc. I just don't know how to point to my method that looks like this:
void HomeScene::doSomething(Ref *pSender, Widget::TouchEventType type);
Failed to find any clue from Google, forum, git, change log, tests...
You should use CC_CALLBACK_2 macro.
Well, I usually subclass my button and add listeners to it. Example: http://cocos2d-x.org/wiki/How_To_Subclass_Sprite_And_Add_Event_Listeners
You can also use this:
button->addTouchEventListener(CC_CALLBACK_2(HomeScene::doSomething,this));
to solve this issue :-)

Launch a phonecall with windowsPhone

I add a page Support in my WindowsPhone Application.
I would like when the user click on Support to launch a phone call.
Do you know how is it possible, i don't find related documentation on it.
[UPDATE]
I try to add this and display in a texblock. doesn't work.
On Android : making a phonecall using a browser application
[UPDATE]
I found http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394025(v=vs.105).aspx and it works correctly enjoy :)
[Update]
It's a task action as send a mail http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh394025(v=vs.105).aspx this link is really good
Best regards,
Alexandre
One solution is to add a PhoneCallTask:
PhoneCallTask callTask = new PhoneCallTask();
callTask.PhoneNumber = "999999";
callTask.DisplayName = "Support";
callTask.Show();
Remember to enable ID_CAP_PHONEDIALER in your WMAppManifest.xml

ChartboostX not loading more apps

I am using this wrapper someone recommended for my iOS cocos2dx game link. It works when I call the showInterstitial() method, but when I try to use the showMoreApps the dialog appears for a split second and then disappears.
In my AppDelegate::applicationDidFinishLaunching() I do this
ChartboostX::sharedChartboostX()->setAppId("REDACTED");
ChartboostX::sharedChartboostX()->setAppSignature("REDACTED");
ChartboostX::sharedChartboostX()->startSession();
ChartboostX::sharedChartboostX()->cacheMoreApps();
And then when I want to call the showMoreApps I do this
ChartboostX::sharedChartboostX()->showMoreApps();
Have a look at my wrapper for Chartboost. It has been updated to use the latest version of the Chartboost SDK and works perfectly in my cocos2D-x game. I have not finished the android documentation yet but you can probably work it out yourself if you need to. The documentation for iOS is almost finished and quite easy to follow.(FYI the class ADELLE is the chartboost delegate and is an objective C++ class so you can use C++ in it as you normally would mixed in with the objective C. This is the same for AdWrapper.mm)
Check it out and see if it works for you.
https://github.com/Lochlanna/Chartboost-Cocos2D-x

StageDisplayState.FULLSCREEN vs StageDisplayState.FULLSCREEN_INTERACTIVE

What's the difference between the the two display states?
StageDisplayState.FULL_SCREEN doesn't support keyboard interactivity. StageDisplayState.FULL_SCREEN_INTERACTIVE does, but it works only with Adobe AIR.
Source: Adobe ActionScript3 Reference
StageDisplayState.FULLSCREEN is available in both AIR and normal Flex web apps, Keyboard is not traced
StageDisplayState.FULLSCREEN_INTERACTIVE available ONLY IN AIR and it allows you to used the keyboard. for ex you can type inside a TextInput in FS only with FullScreenInteractive.
StageDisplayState.FULL_SCREEN_INTERACTIVE can work in flex webapp.when you compile web app,you just need to replace the playerglobal.swc by high version,like 11.7。。。
hope it helps you