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.

1  
static JComponent jMaxSpeedAnimationWithStats(IF0<Pair<BufferedImage, O>> renderFrameWithStats) {
2  
  new ImageSurface is;
3  
  is.pixelate(true);
4  
  //is.autoZoomToDisplay(true);
5  
  new DoubleFPSCounter fps;
6  
  var lblStats = jlabel();
7  
  awtCalcContinuously(is, -> {
8  
    try {
9  
      var imageAndStats = renderFrameWithStats!;
10  
      var image = pairA(imageAndStats);
11  
      if (image != null) {
12  
        fps.inc();
13  
        is.setImage(image);
14  
        setText(lblStats, joinNemptiesWithComma(fps, pairB(imageAndStats)));
15  
      } else
16  
        sleep(10);
17  
    } catch print e {
18  
      setText(lblStats, exceptionToStringShort(e));
19  
      sleepSeconds(1); // error penalty
20  
    }
21  
  });
22  
  
23  
  ret centerAndSouth(jscroll_center_borderless(is), withMargin(lblStats));
24  
}

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: 94 / 200
Version history: 13 change(s)
Referenced in: [show references]