Skip to content
This repository has been archived by the owner on May 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request valotrading#6 from jvirtanen/features/attributes
Browse files Browse the repository at this point in the history
Add attributes
  • Loading branch information
penberg committed Jul 20, 2012
2 parents a927287 + 8cac428 commit 435c35a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/ncurses4j/NCurses.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,25 @@ public interface NCurses {
short COLOR_WHITE = 7;

GlobalIntVariable COLOR_PAIRS = new GlobalIntVariable("COLOR_PAIRS");

// Try to mimic the ncurses header file.
int A_NORMAL = (1 - 1);
int A_STANDOUT = NCURSES.BITS(1, 8);
int A_UNDERLINE = NCURSES.BITS(1, 9);
int A_REVERSE = NCURSES.BITS(1, 10);
int A_BLINK = NCURSES.BITS(1, 11);
int A_DIM = NCURSES.BITS(1, 12);
int A_BOLD = NCURSES.BITS(1, 13);
int A_PROTECT = NCURSES.BITS(1, 16);
int A_INVIS = NCURSES.BITS(1, 15);
int A_ALTCHARSET = NCURSES.BITS(1, 14);
int A_CHARTEXT = NCURSES.BITS(1, 0) - 1;

public static abstract class NCURSES {
public static final int ATTR_SHIFT = 8;

public static int BITS(int mask, int shift) {
return mask << (shift + NCURSES.ATTR_SHIFT);
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/ncurses4j/examples/HelloWorld.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public static void main(String[] args) {
}
}

ncurses.attron(NCurses.A_BOLD);

int maxx = ncurses.getmaxx(stdscr);
int maxy = ncurses.getmaxy(stdscr);

Expand Down

0 comments on commit 435c35a

Please sign in to comment.