Author Topic: Why OnTimer() is not called 30 times per second?  (Read 1580 times)

Dexter384

  • Guest
Why OnTimer() is not called 30 times per second?
« on: February 04, 2014, 11:32:41 am »
Hello !
I made a program that normally runs on a computer. The number of OnTimer() calls per second for iphone4S - 5 times for iphone5 - 17.
It seems all the code is optimal, loaded with over ~200 views and ~200 images. Pictures are not used to make invisible.
Added 2 BitmapSurfaces: 568x320 and 1280x800. large BitmapSurface made ​​invisible.
Added 5 "touches" to fit the screen.
Use Box2D. Number of force iterations = contact iterations = 10. Timestep = 1.0f/25.0f.
Dynamic bodies is not much, about 10.
Why OnTimer() is not called 30 times per second?

dhjennings

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Re: Why OnTimer() is not called 30 times per second?
« Reply #1 on: February 05, 2014, 05:52:11 pm »
It's apparent that your code within the OnTimer() call takes longer than 33msec (i.e, 1/30 second) to run. Thus the smaller than the  "expected" number of OnTimer() calls per second.

Dexter384

  • Guest
Re: Why OnTimer() is not called 30 times per second?
« Reply #2 on: February 05, 2014, 11:06:46 pm »
Strange, but I measured the total runtime. It is about 30 ms. I added the game a huge bitmap. Added huge DravSurface (2000 to 2000 pix). I'm moving this DravSurface. Could this be the reason?