File: cursestest.k

package info (click to toggle)
kaya 0.4.2-4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 4,448 kB
  • ctags: 1,694
  • sloc: cpp: 9,536; haskell: 7,461; sh: 3,013; yacc: 910; makefile: 816; perl: 90
file content (46 lines) | stat: -rw-r--r-- 746 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
program cursestest;

import Curses;

Void main()
{
    try {
	initScreen(); cbreakMode(true); echoMode(false); 
	newlineMode(false); intrFlush(stdscr, false);
	startColour();
	setCursor(Invisible);

	if (hasColours()) {
	    initPair(1,Red,Black);
	    initPair(2,Green,Yellow);
	}

	box(stdscr);
	refresh();

	win = newWin(10,60,5,5);

	wAttributes(win,[Bold,ColourPair(1)],true);

	intrFlush(win,false);
	box(win);
	wRefresh(win);

	wMove(win,2,5);
	waddStr(win,"Hello world!");
	wAttributes(win,[Bold],false);
	wAttributes(win,[Normal, ColourPair(2)],true);
	wMove(win,7,35);
	waddStr(win,"Foo!");
	wRefresh(win);
	refresh();

	x = wgetChar(win);
	endWin();
	putStrLn("You pressed '"+x+"'");
    }
    catch(e) {
	endWin();
	throw(e);
    }
}