xna - Monogame - How to properly cap FPS in Monogame? -


i wanted cap fps of game @ 30fps conditionally if being built windows phone, don't need running @ 60fps on , heard many better have capped on mobile device because of battery draining.

i used same snippet of code used xna windows phone 7:

//framerate 30fps default windowsphone. targetelapsedtime = timespan.fromticks(333333); 

but... doing job capping fps, affecting else too, causing stuttering , sound issues. because of this, suppose i'm doing wrong.

anything me great, not able find on internet regarding issue (most people wanted quite opposite :d )

to fix sound issues multi-threading , running sound system on separate, uncapped thread. game code, code updates assets, method should work, differently.

// in game1 class variable definitions private const float timetonextupdate = 1.0f / 30.0f; private float timesincelastupdate;  //in game1 update method public override void update(gametime gametime) {     timesincelastupdate += (float)gametime.elapsedgametime.totalseconds;      if (timesincelastupdate >= timetonextupdate)     {         //update game         timesincelastupdate = 0;     }     //systems don't want limit updated here }     

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -