Uses 3874K of libraries. Click here for Pure Java version (4008L/28K/99K).
!7 static int w = 32, h = 16, ww = 400, hh = 200; static DirectSurface ds; static BufferedImage img; sbool continuous = false, rareRepaint = true, shootInParallel = true; static int speed = 0; static volatile BufferedImage src = null; static long screenshotTime = 0; static int frames; static long start; sclass DirectSurface extends Surface { BufferedImage img; *() {} *(BufferedImage *img) {} public void render(int w, int h, Graphics2D g) { g.drawImage(img, 0, 0, null); } public Dimension getPreferredSize() { ret new Dimension(img.getWidth(), img.getHeight()); } } p-substance { img = newBufferedImage(ww, hh); showPackedFrame(ds = new DirectSurface(img)); shootMaybe(); if (shootInParallel) thread { repeat with sleep 100 { shootMaybe(); } } thread { PerSecondCounter fps = new(5); long consoleUpdate = 0; repeat { if (!shootInParallel) shootMaybe(); ++frames; start = sysNow(); for (int y = 0; y < hh; y += h) for (int x = 0; x < ww; x += w) { int srcw, srch; if (src != null) { srcw = src.getWidth(); srch = src.getHeight(); } else { Dimension ss = screenSize(); srcw = ss.width; srch = ss.height; } int srcX = random(srcw-w), srcY = random(srch-h); if (continuous) drawImageOnImage(screenshot(srcX, srcY, w, h), img, x, y); else copyImagePart(src, srcX, srcY, img, x, y, w, h); if (!rareRepaint) ds.paintImmediately(x, y, w, h); sleep(speed); } if (rareRepaint) ds.repaint(); //consoleStatus(iterationsPerSecond(frames, sysNow()-start) + " fps"); fps.inc(); if (sysNow() >= consoleUpdate+1000) { consoleUpdate = sysNow(); consoleStatus(iround(fps!) + " fps"); } } } } svoid shootMaybe { if (!continuous && (src == null || sysNow() > screenshotTime+1000)) { src = screenshot(); screenshotTime = sysNow(); } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1008796 | 
| Snippet name: | Shuffle (graphical) | 
| Eternal ID of this version: | #1008796/42 | 
| Text MD5: | 1ff2e29e82b62d72d6f16db08654d9ba | 
| Transpilation MD5: | 26f64a54e666c7ed1cb220b16c643968 | 
| Author: | stefan | 
| Category: | javax / homepage | 
| Type: | JavaX source code | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2017-06-07 01:19:19 | 
| Source code size: | 2156 bytes / 83 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 804 / 1103 | 
| Version history: | 41 change(s) | 
| Referenced in: | [show references] |