tetris in D in webassembly

Adam D. Ruppe destructionator at gmail.com
Tue Aug 11 13:37:59 UTC 2020


On Tuesday, 11 August 2020 at 13:22:02 UTC, jmh530 wrote:
> The blog post says it is space bar. Tripped me up too.

Yeah, I learned yesterday that there's a whole other PC tetris 
world I had no clue about.

I only ever played the Nintendo/ELORG version on the NES. On 
that, dpad is left, down, speed, and then the A button is rotate. 
So for my clone I based it on that, arrows move, space bar, on 
the opposite side of the controller, does the rotation.

The specifics of piece movement etc. are kinda based on that NES 
game too and the newer PC games have all kinds of other rules 
that I just never knew.

But oh well, the game was at first something to just kill time on 
a boring flight, so I wrote it from memory on my laptop. Then it 
posted as a simpledisplay.d demo basically. And now I used it for 
webassembly because I thought it was super cool to have the very 
same source code we used on desktop last week in the browser this 
week (even though like I said there, I cut a LOT of corners to 
finish it in my limited time).

Now I kinda want to expand the library a bit more. It occurs to 
me if I did draw text too and a little bit more input events, 
then my terminal emulator could run in the browser. Then my 
terminal client code can go there since it can embed the 
emulator. And a little more work, minigui.d's custom widgets can 
too...

It wouldn't be a good experience tbh but it might be cool online 
demos of future programs and can also load up some of these 
little games etc on mobile too though the browser.


More information about the Digitalmars-d-announce mailing list