Show HN: Tetris in a PDF
961 by ThomasRinsma | 173 comments on News.
I realized that the PDF engines of modern desktop browsers (PDFium and PDF.js) support JavaScript with enough I/O primitives to make a basic game like Tetris. It was a bit tricky to find a union of features that work in both engines, but in the end it turns out that showing/hiding annotation "fields" works well to make monochrome pixels, and keyboard input can be achieved by typing in a text input box. All in all it's quite janky but a nice reminder of how general purpose PDF scripting can be. The linked PDF is all ASCII so you can just open it in a text editor, or have a look at the source code here: https://ift.tt/Ti5ucO1
Subscribe to:
Post Comments (Atom)
New best story on News: AMD expects to outsell Intel in Q4 for the first time in history
AMD expects to outsell Intel in Q4 for the first time in history 568 by rbanffy | 210 comments on News.
-
Show HN: 2048 turned 10 this year, I built an updated version to celebrate 496 by terabytest | 168 comments . Hi all! My name is Gabriele...
-
France to ditch Windows for Linux to reduce reliance on US tech 451 by Teever | 185 comments on
-
Deep Reinforcement Learning: Zero to Hero 484 by alessiodm | 43 comments on News.
No comments:
Post a Comment