File tree Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Expand file tree Collapse file tree 2 files changed +6
-18
lines changed Original file line number Diff line number Diff line change @@ -257,19 +257,12 @@ public void run() {
257
257
private void scheduleNextDraw () {
258
258
handler .removeCallbacks (drawRunnable );
259
259
component .requestDraw ();
260
- int waitMillis = 1000 / 15 ;
260
+ int targetMillis = 1000 / 15 ;
261
261
if (sketch != null ) {
262
- final PSurfaceGLES glsurf = (PSurfaceGLES ) sketch .surface ;
263
- float targetfps = glsurf .pgl .getFrameRate ();
264
- float targetMillisPerFrame = 1000 / targetfps ;
265
-
266
- // float actualFps = sketch.frameRate;
267
- // float actualMillisPerFrame = 1000 / actualFps;
268
- // int waitMillis = (int)PApplet.max(0, targetMillisPerFrame - actualMillisPerFrame);
269
- waitMillis = (int ) targetMillisPerFrame ;
262
+ targetMillis = (int )(1000 / sketch .frameRateTarget );
270
263
}
271
264
if (component .canDraw ()) {
272
- handler .postDelayed (drawRunnable , waitMillis );
265
+ handler .postDelayed (drawRunnable , targetMillis );
273
266
}
274
267
}
275
268
Original file line number Diff line number Diff line change @@ -289,19 +289,14 @@ public void run() {
289
289
private void scheduleNextDraw () {
290
290
handler .removeCallbacks (drawRunnable );
291
291
component .requestDraw ();
292
- int waitMillis = 1000 / 15 ;
292
+ int targetMillis = 1000 / 15 ;
293
293
if (sketch != null ) {
294
294
final PSurfaceGLES glsurf = (PSurfaceGLES ) sketch .surface ;
295
295
float targetfps = glsurf .pgl .getFrameRate ();
296
- float targetMillisPerFrame = 1000 / targetfps ;
297
-
298
- // float actualFps = sketch.frameRate;
299
- // float actualMillisPerFrame = 1000 / actualFps;
300
- // int waitMillis = (int)PApplet.max(0, targetMillisPerFrame - actualMillisPerFrame);
301
- waitMillis = (int ) targetMillisPerFrame ;
296
+ targetMillis = (int )(1000 / targetfps );
302
297
}
303
298
if (component .canDraw ()) {
304
- handler .postDelayed (drawRunnable , waitMillis );
299
+ handler .postDelayed (drawRunnable , targetMillis );
305
300
}
306
301
}
307
302
You can’t perform that action at this time.
0 commit comments