[Vala] Curses bindings :-)



Hello everyone,

After reading a lot of manpages, taking a look at a lot of function
prototypes, etc. I've finally finished writing my (n)curses bindings for
Vala! This means that you can now write fancy curses applications using
a nice object oriented language. Below is a small sample application:

| using GLib;
| using Curses;
| 
| class HelloWorld {
|       public static int main(string[] args) {
|               initscr();
|               start_color();
| 
|               init_pair((short)1, Color.GREEN, Color.RED);
| 
|               var win = Window.newwin(LINES - 8, COLS - 8, 4, 4);
|               win.bkgdset(COLOR_PAIR(1) | Attribute.BOLD);
|               win.addstr("Hello world!");
|               win.clrtobot();
|               win.getch();
| 
|               endwin();
|       }
| }

I've attached two files:

- curses.vala:
  The Vala bindings for the Curses library. I've tested it with ncurses
  5.6 on FreeBSD, but in theory it should work with other curses
  implementations as well (Solaris curses, PDCurses).
- curses.pc:
  The pkg-config file I used to make valac understand --pkg curses.
  Adjust this to your own needs.

Have fun! :-)

-- 
 Ed Schouten <ed fxq nl>
 WWW: http://g-rave.nl/

Attachment: curses.vala
Description: Text document

Attachment: curses.pc
Description: Text document

Attachment: pgpXgX3uPqgzR.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]