Search code examples
actionscript-3design-patternsmobilekinect-sdk

structuring code when targeting both mobile and Kinect devices


Building several games using Starling and the AIRKinect framework targeting Windows Kinect sensors.

I'd like to package and refactor my classes in such a way that I can easily repurpose the bulk of the code and target mobile(primarily IOS) devices. ie touch and multitouch support would replace any AIRKinect specific skeletal tracking code.

Although I 'm coding in Actionscript 3, I think the same general code structure should remain code agnostic.

What would be a good way to structure my classes? Which design patterns come to mind?


Solution

  • Basically, you could create an interface, like IController and several platform-dependent classes that implement that interface, for example KinectController and TouchController. Then you could check system capabilities at runtime and create either KinectController or TouchController. The usage won`t depent on concrete class as both would implement IController.

    That's a very basic answer but I just cannot answer more specifically as I don`t know anything more about your project.