PHP ncurses window


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #!/usr/bin/env php
  2. <?php
  3.  
  4. // we begin by initializing ncurses
  5. $ncurse = ncurses_init();
  6.  
  7. // let ncurses know we wish to use the whole screen
  8. $fullscreen = ncurses_newwin(0, 0, 0, 0);
  9.  
  10. // draw a border around the whole thing.
  11. ncurses_border(0,0, 0,0, 0,0, 0,0);
  12.  
  13. // now lets create a small window
  14. $small = ncurses_newwin(10, 30, 7, 25);
  15.  
  16. // border our small window.
  17. ncurses_wborder($small,0,0, 0,0, 0,0, 0,0);
  18.  
  19. ncurses_refresh();// paint both windows
  20.  
  21. // move into the small window and write a string
  22. ncurses_mvwaddstr($small, 5, 5, " Test String ");
  23.  
  24. // show our handiwork and refresh our small window
  25. ncurses_wrefresh($small);
  26.  
  27. $pressed = ncurses_getch();// wait for a user keypress
  28.  
  29. ncurses_end();// clean up our screen
  30.  
  31. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.