Accurate timing in iOS

后端 未结 7 1366
生来不讨喜
生来不讨喜 2020-12-01 02:32

I am looking at the \'Metronome\' sample code from the iOS SDK (http://developer.apple.com/library/ios/#samplecode/Metronome/Introduction/Intro.html). I am running the metro

7条回答
  •  南方客
    南方客 (楼主)
    2020-12-01 03:02

    I'm very interested in this too, also noticed the fallacy of using NSTimer and the Metronome example.

    I'm currently looking into CAMediaTiming Protocol...yet i have no idea how to use it, but it could prove to be a more precise solution as it's used for animations. I could also be completely wrong since games slow down when too much goes on. I'm basing my theory on my favorite game where precise timing is required when "fighting opponents on the streets". The game's fps has been reduced to 30 i think compared to its console counterparts which clocks at 60. Yet the game's combo system's timing is very crucial, e.g. a combo consists of hitting a button then another one exactly 3 frames later, so either:

    • the game on the iOS is more forgiving on timing
    • the developers implemented their own timing system
    • else they're using the Metronome's timer loop or the CAMediaTiming protocol.

    Info on timing in animations is found here: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/Animation_Types_Timing/Articles/Timing.html#//apple_ref/doc/uid/TP40006670-SW1

提交回复
热议问题