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

24
LINES

< > BotCompany Repo | #1035881 // JMaxSpeedAnimation

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

Libraryless. Click here for Pure Java version (19190L/120K).

sclass JMaxSpeedAnimation is Swingable {
  settable IF0<BufferedImage> renderFrame;
  gettable new ImageSurface imageSurface;
  gettable new DoubleFPSCounter fps;
  
  *() {}
  *(IF0<BufferedImage> *renderFrame) {}
  
  cachedVisualize {
    imageSurface.pixelate(true);
    imageSurface.autoZoomToDisplay(true);
    awtCalcContinuously(imageSurface, -> {
      var img = renderFrame!;
      fps.inc();
      displayNewImage(img);
    });
    ret jscroll_center_borderless(imageSurface);
  }
  
  // image may be null (=no update)
  swappable void displayNewImage(BufferedImage image) {
    if (image != null) imageSurface.setImage(image);
  }
}

Author comment

Began life as a copy of #1035609

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1035881
Snippet name: JMaxSpeedAnimation
Eternal ID of this version: #1035881/7
Text MD5: 10c3538c64f26b47d75cb708b2c0c173
Transpilation MD5: 46ce5f979a7eb692e9dea2949d1c98bb
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-08-17 22:05:37
Source code size: 668 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 180 / 257
Version history: 6 change(s)
Referenced in: #1003674 - Standard Classes + Interfaces (LIVE continued in #1034167)