- ache,
Bonjour,
Je cherche à compiler un programme utilisant ncurses vers un environnement type navigateur.
Voilà un exemple de programme:
#include <stdlib.h>
#include <stdio.h>
#include <ncurses.h>
const char* clem_happy =
" ,lc \n"
" .:xkdo. \n"
" :xkkdoo, \n"
" 'dkkkxoooc \n"
" .okkkkxooodd \n"
" ;l,. ;xkkxkxdooddd. \n"
" lxxkxc' .okkkkkxxoodddd. \n"
" ,xxxkxkxl, 'xkkkkxkxooddddx. \n"
" .xxxxxkkkkxl. ,xkkkkxkxdoddddxx. \n"
" cxxxxxkxkkkkd, ,kkkkxkxkdoddddxxx \n"
" .ddxxxxxkxkkkkx; .xkkkkkxkxoddddxxxc \n"
" cdddxxxxxkxkkkkx, dkkkkkkkxoddddxxxx. \n"
" .oddddxxxkxkkkkkkl 'kkkkxkxkdddddxxxko \n"
" 'odddddxxxxxkkkkkd. ckkkkkxkdddddxxxxx. \n"
" :oodddddxxkxkkkkkd okkkxkkxddddxxxkx' \n"
" :ooddddddxxkxkkkkl dkkkkxxddddxxxkx' \n"
" ;oooddddddxxkxkkk' okkxkkdddxxxxkd. \n"
" .looodddddxxxkkko ckxkxxddxxxxx; \n"
" 'loooddddxxxkkk. ,kkxxddxxxxl. \n"
" 'coooddddxkxk' xkxddxxxl. \n"
" .,loodddxxk; :xddxd:. \n"
" .':odddx; ddc. \n"
" .';l:,;.c \n"
" ..cdxd. \n"
" ..';;;;;;;:oxl::;;,'.. \n"
" .';;;;;;;;;;;:lldol:;;;;;;;,. \n"
" ';;;;;;;;;;,,,,;;:c:;;,;;;;;;;;;. \n"
" ';;;;;;;;,,,,,,,,,,,,,,,,,,,,;;;;;;;. \n"
" ,;;;;;;;;;;;,,,,,,,,,,,,,,,,;;;;;;;;;;' \n"
" ;;;;;;;;,,,,,,'''''''''''''',,,,,,;;;;;;, \n"
" ,;;;;;;,,,,,,'''''''''''''''''',,,,,,,;;;;' \n"
" .;;;;;;,,;c:,'''''''......'''''':c',,,,,;;;;. \n"
" ';;;;;,,l0Kxdd''''...........',OK0oO;,,,;;;;' \n"
" ;;;;;;,,lk,OKx'''............',O':KO;,,,;;;;; \n"
" ;;::;;,,,;ll:''''............''':c:,,,,;:;;;;. \n"
" ;:cll;;,,codoc''''..........''':odo:,,;:cl:;;. \n"
" '::::;;,xXXKKK0xl:,''....',:lx0KKKXXx,,;::;;; \n"
" ;;;;;;;0XKKKKKKK000OkkkO00KKKKKKKXXO,;;;;;;, \n"
" .:;;;;;dXKKKKKKK00000000000KKKKKKKXo;;;;;;;. \n"
" '::;;;;OKKKKKKK00000000000KKKKKKKx;;;;;;:. \n"
" .::::::xKKKKKKK000000000KKKKKKKd;::::::. \n"
" .:ccc::lkKKK000OO0000000KKKKxc:::ccc; \n"
" .:lcccccdxkOOkkkkkkOOOkxoccccccc;. \n"
" .;llllllcclooooooolccllllllc' \n"
" .,clooooooooooooooool;'. \n"
" .',;;::::::;,'.. \n";
const char* clem_sad =
" 'o: \n"
" okxo; \n"
" .dkxdoo, \n"
" .dkkkdooo. \n"
" . .xkkkxooodl \n"
" dxl' .xkkkxxooodd, \n"
" .xxxkx:. dkkkxkxoodddd \n"
" .xxxxxkxl. okkkkkxdoddddx, \n"
" .xxxxxxkkko. :kkkxkxxdodddxxl \n"
" dxxxxxkxkkkl. .xkkkkxkxdddddxxx \n"
" oddxxxxkkkkkx:lkkkkxkxxddddxxxx. \n"
" :dddxxxxxkxkkkkkkkkkxxxddddxxxk. \n"
" .dddddxxxxkkkkkkkxkxkkddddxxxxk. \n"
" loddddxxxkxkkkkkkxkkxddddxxxkd \n"
" 'ooddddxxxkxkkkkkkxxxdddxxxxk, \n"
" coodddddxxkkkkkkkkkxdddxxxko \n"
" loodddddxkxkxkkkkxxddxxxxx. \n"
" coooddddxxkkkkkkxxddxxxx. \n"
" ,oooddddxxkxkkkxddxxxx. \n"
" .cooodddxxkkkxxddxxo. \n"
" .coodddxkxkkxdxx: \n"
" .;ooddxkkxxdo. \n"
" .cddxl:d' \n"
" .coo, \n"
" ......oxl... \n"
" ..';;;;;;;;:cxoc:;;;;,.. \n"
" .,;;;;;;;;;;;;ccool:;;;;;;;;'. \n"
" ';;;;;;;;;,,,,,,;;;;;,,,,;;;;;;;,. \n"
" .;;;;;;;,,,,,,,,,,,,,,,,,,;:c;,;;;;;' \n"
" ';;;;;;,,,,,,,,,''''''''',,lll;,,,;;;;, \n"
" ';;;;;;;,,,,,,'''''''''''''',,,,,,;,;;;;; \n"
" .;;;;;;,,,;,,''''''''''''''''''',,,,,,;;;;, \n"
" ,;;;;;,,,;'',;''''.........''';,'';,,,,;;;;. \n"
" ;;;;;;,,:. ,;,'..........',,, .;,,,,;;;, \n"
" .;;;;;,,,,,..',''.............',...,,,,,,;;;; \n"
" .;;;;;;,,,,,,'''''...........'''',',,,,,;;;;;. \n"
" ;;;;;;,,,,,,''''''.........'''''',,,,,,;;;;;. \n"
" ,;;;;;;,,,,,,''''''''''''''''''',,,,,,;;;;;; \n"
" .:;;;;;;,,,,...........'''''',,,,,,,,;;;;;;. \n"
" .:;;;;;;,,. .,,,;;;;;;, \n"
" '::::;;;;. .;;;;;:::; \n"
" .:::::::'.....................::::::c, \n"
" ,ccccccc:::::::::::::::::::cccccc;. \n"
" 'cllllcccccccccccccccccccllll;. \n"
" .;llllllllllllllllllllll;. \n"
" .';:cloooooooolc:;'. \n"
" ........ \n";
int main(void) {
/* Initialize ncurses */
initscr();
noecho();
cbreak();
keypad(NULL, 0);
intrflush(NULL, 0);
curs_set(0);
printw("%s", clem_happy);
int c;
while ( (c = getch()) != 'q' )
switch ( c ) {
case 'A':
case 'D':
refresh();
move(0,0);
printw("%s", clem_happy);
break;
case 'B':
case 'C':
refresh();
move(0,0);
printw("%s", clem_sad);
break;
}
refresh();
return EXIT_SUCCESS;
}
Savez-vous si c’est faisable ? Comment je dois me débrouiller ? J’ai essayé mais je n’ai pour l’instant rien de concluant, il me manques quelque chose ?
Merci !
PS: J’ai oublié de préciser l’erreur !
"Error opening terminal: emsc."
Lorsque de l’exécution du programme.
Je compile comme ça:
emcc t.c -s WASM=1 -o test.html -I ./ncurses-6.1/build/include/ -L ./ncurses-6.1/build/lib/ -lncurses
Bien-sûr, j’ai compiler ncurses également avec emscripten.
+0
-0