Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

24
LINES

< > BotCompany Repo | #1035612 // jMaxSpeedAnimationWithStats

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (19243L) is out of date.

static JComponent jMaxSpeedAnimationWithStats(IF0<Pair<BufferedImage, O>> renderFrameWithStats) {
  new ImageSurface is;
  is.pixelate(true);
  //is.autoZoomToDisplay(true);
  new DoubleFPSCounter fps;
  var lblStats = jlabel();
  awtCalcContinuously(is, -> {
    try {
      var imageAndStats = renderFrameWithStats!;
      var image = pairA(imageAndStats);
      if (image != null) {
        fps.inc();
        is.setImage(image);
        setText(lblStats, joinNemptiesWithComma(fps, pairB(imageAndStats)));
      } else
        sleep(10);
    } catch print e {
      setText(lblStats, exceptionToStringShort(e));
      sleepSeconds(1); // error penalty
    }
  });
  
  ret centerAndSouth(jscroll_center_borderless(is), withMargin(lblStats));
}

Author comment

Began life as a copy of #1035609

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035612
Snippet name: jMaxSpeedAnimationWithStats
Eternal ID of this version: #1035612/14
Text MD5: 5f52a110184ee9bc7e54481aab8cc7ae
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-12 02:41:00
Source code size: 770 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 191 / 318
Version history: 13 change(s)
Referenced in: [show references]