| 366 | onlyThread = Thread.currentThread(); |
| 367 | |
| 368 | while (true) try { |
| 369 | if (graphicsContext.lock.tryLock(1, TimeUnit.DAYS)) { |
| 370 | try { |
| 371 | loop(); |
| 372 | } catch (Throwable t) { |
| 373 | t.printStackTrace(); |
| 374 | } |
| 375 | } else { |
| 376 | } |
| 377 | } catch (InterruptedException e) { |
| 378 | e.printStackTrace(); |
| 379 | } finally { |
| 380 | graphicsContext.lock.unlock(); |
| 381 | } |
| 382 | } |
| 383 | }.start(); |
| 384 | |
| 385 | } |
| 386 | |
| 387 | @Override |
| 388 | public String generateMarkdown(Box inside, Dict.Prop property) { |
| 389 | |
| 390 | return "Window <code>'" + title + "'</code> of dimensions <code>" + getBounds() + "</code> has been drawn <code>" + frame + "</code> time" + (frame == 1 ? "" : "s") + ". Average, " + |
| 391 | "recent framerate is <code>" + String.format("%.2f", frameRate) + "</code> fps"; |
| 392 | |
| 393 | } |
| 394 | |
| 395 | boolean focused = false; |
| 396 | |
| 397 | static public long lastFrameAt = 0; |
| 398 | static public long interframeTime = 0; |
| 399 | |
| 400 | public void loop() { |
| 401 | |
| 402 | currentWindow.set(this); |