Can I support VoiceOver in my Cocos2D-iPhone game?

I am making a game in which a player reacts to sounds through movement - seeing that a visual element is not needed to play it, and many play with their eyes closed, it seems embarrassing not to fully integrate with VoiceOver. I am currently using Cocos2D-iPhone and CocosDenshion for audio, and now I'm starting to think about how I will build my menu system to select levels and customize controls.

Is it possible to easily support VoiceOver in the Cocos2D menu system, or should I try to create my menus in UIKit that I have no experience with?

+4
source share
2 answers

I donโ€™t know if the Cocos VoiceOver menu system supports it, but if it is not, you can probably add the functionality you are looking for without going into much of UIKit work. All you have to do is create a subclass of UIView that will be added to the main window when your application starts. Then use the UIAccessibilityContainer and UIAccessibilityPostNotification calls so that users can interact with your game through VoiceOver.

The UIAccessibilityContainer protocol allows you to tell VoiceOver which interface elements are currently on the screen, their shortcuts, their features, etc. VoiceOver then uses this information so that users can scroll between items and receive feedback from them.

When your game changes, you can change what this protocol sends, and then release

UIAccessibilityPostNotification (UIAccessibilityLayoutChangedNotification, nil)

... tell VoiceOver that the screen layout has changed. And just to say something through VoiceOver, tell me when your game has changed, you can send another notification to say some text:

UIAccessibilityPostNotification (UIAccessibilityAnnouncementNotification, @ "Achievement Unlocked!");

+4
source

No need to go with the UIKit framework, you can go with your own methods and the cocos2d class to implement this.

For the sound option, we have a SimpleAudioEngine that you can use. you can distinguish sound using its identifier, which is of type ALuint .

ALuint soundEffectID;

 //to start soundEffectID=[[SimpleAudioEngine sharedEngine] playEffect:@"my sound"]; //to stop [[SimpleAudioEngine sharedEngine] stopEffect:soundEffectID]; 

You need to manage this effect, and I think your problem will be solved.

-3
source

Source: https://habr.com/ru/post/1403778/


All Articles