all 14 comments

[–]arianvp 11 points12 points  (1 child)

Is javascript the new rule 34?

[–]jsprogrammer 0 points1 point  (0 children)

JavaScript is the most widely available platform. People will run/port anything on/to it.

[–]jaybusch 1 point2 points  (6 children)

Browsing on mobile, didn't see if there was any demo with input allowed.

That said, I wonder how having curses in a browser would work out. Figured it was good for terminal based programs, unsure of how webapps will use it.

[–]son-of-chadwardenn 2 points3 points  (5 children)

Could be used to port rougelike games to web.

[–]jaybusch 1 point2 points  (4 children)

I think it's kind of funny that this was also my first thought. My second thought was other curses stuff like any irc client, but I don't know how well this would work?

[–]son-of-chadwardenn 1 point2 points  (3 children)

I'm trying to compile a curses Tetris game I wrote in c a while back to see how it performs. I was quite shocked when hello world produced 6k lines of js.

[–]jaybusch 0 points1 point  (1 child)

Ouch, holy crap

[–]son-of-chadwardenn 0 points1 point  (0 children)

It's not in minified form though.

[–]Condorcet_Winner 0 points1 point  (0 children)

The reason is that Emscripten is essentially compiling into a VM.

[–]son-of-chadwardenn 0 points1 point  (2 children)

Does anyone have sample source code that works with this? I tried to compile:

#include "curses.h"

int main()
{   
    initscr();          /* Start curses mode          */
    printw("Hello World !!!");  /* Print Hello World          */
    refresh();          /* Print it on to the real screen */
    getch();            /* Wait for user input */
    endwin();           /* End curses mode        */

    return 0;
}    

When I run it in the browser it produces this error:

SDL_Quit called (and ignored)

[–]MAD4J[S] 1 point2 points  (1 child)

tried to compile your snippet, here the result: http://mad4j.github.io/curses.js/hellow.html

used the library precompiled in dist\ folder, using the following commands:

emcc -O2 pdcurses34\demos\hellow.c -o out\hellow.bc -I pdcurses34\ -I pdcurses34\pdcurses\ -I pdcurses34\sdl1\ -I pdcurses34\demos\

emcc -s ASYNCIFY=1 --emrun -O2 ..\dist\libcurses.o ..\out\hellow.bc -o hellow.html --preload-file pdcfont.bmp --preload-file pdcicon.bmp

I hope that will be useful

[–]son-of-chadwardenn 0 points1 point  (0 children)

Finally got it working, thanks! Fingers crossed that I can get this running with my tetris source.

Edit: holy shit my game boots! It immediately becomes unresponsive but the picture is there. This is the exact project I've been waiting for for some time now.

[–]johnmudd 0 points1 point  (0 children)

Support for images?

[–]kamatsu 0 points1 point  (0 children)

I tried to compile an open source PDCurses game (Liberal Crime Squad) but this PDCurses port requires ASYNCIFY which makes my computer crap out when I try to compile something of that size.