venetox Posted October 22, 2016 Share Posted October 22, 2016 (edited) Just had a thought. If you wanted to limit your refresh rate to say 10fps. Instead of redrawing each time in your onpaint. Have an Image stored in memory, then ever 1/10th of a second update it in your paint code. So some code off the top of my head. functions wont be right and you will have to put everything that you currently do in redrawImage and have it output to a single image of just the stuff to be drawn. currenttime = System.currentTimeMilliseconds(); if(nextdrawtime-currenttime <= 0) { storedImage = redrawImage(); nextdrawtime = currenttime+100; } g.draw(storedImage); // I know that won't be correct call, on phone and don't use paint much That would mean every 100ms it updates the storedImage with the new stuff that should be on screen then draws it. If its less than 100ms since last redraw of image, just draw image from memory, which should be a lot less resource intensive then doing all of the other stuff. In theory at least, just an idea, no clue if it will have intended effect. Edited October 22, 2016 by venetox Quote Link to comment Share on other sites More sharing options...
Trees Posted October 27, 2016 Share Posted October 27, 2016 Just add a timer and find the average frequency of the paint and only paint every x time. In LoL, it's based on every time DX EndScene is called, which is effectively measured through FPS. So if your FPS is 300, there's no sense in drawing 300x a second when your monitor is only 60 Hz. Quote Link to comment Share on other sites More sharing options...
Botre Posted October 28, 2016 Share Posted October 28, 2016 Just add a timer and find the average frequency of the paint and only paint every x time. In LoL, it's based on every time DX EndScene is called, which is effectively measured through FPS. So if your FPS is 300, there's no sense in drawing 300x a second when your monitor is only 60 Hz. It's capped at 60 (I think) FPS. I wouldn't recommend going this way, everything will look stuttered. Quote Link to comment Share on other sites More sharing options...
Trees Posted October 29, 2016 Share Posted October 29, 2016 It's capped at 60 (I think) FPS. I wouldn't recommend going this way, everything will look stuttered. Yeah it would be better if there was an event for when the client paints, since onPaint is probably ran at the same frequency as onLoop. Quote Link to comment Share on other sites More sharing options...