diff options
Diffstat (limited to 'color_palette.c')
-rw-r--r-- | color_palette.c | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/color_palette.c b/color_palette.c new file mode 100644 index 0000000..e839e8b --- /dev/null +++ b/color_palette.c @@ -0,0 +1,69 @@ +#include "color_palette.h" +#include <ncurses.h> + +void set_pairs() +{ + init_pair(2, COLOR_BLUE, COLOR_BLUE); + init_pair(3, COLOR_YELLOW, COLOR_BLACK); + init_pair(4, COLOR_MAGENTA, COLOR_MAGENTA); + init_pair(5, COLOR_YELLOW, COLOR_BLACK); + init_pair(6, COLOR_RED, COLOR_BLACK); + init_pair(7, COLOR_BLUE, COLOR_BLACK); + init_pair(8, COLOR_MAGENTA, COLOR_BLACK); +} + +void paint_field_element(int element) +{ + int color; + switch(element) { + case block: + color = COLOR_PAIR(2); + break; + case coin: + color = COLOR_PAIR(3) | A_BOLD; + break; + case door: + color = COLOR_PAIR(4); + break; + } + attrset(color); +} + +void paint_stats() +{ + attrset(COLOR_PAIR(5)); +} + +void paint_ghost(enum ghost_color color, int blink) +{ + int attr; + switch(color) { + case red: + attr = COLOR_PAIR(6); + break; + case pink: + attr = COLOR_PAIR(8); + break; + case blue: + attr = COLOR_PAIR(7); + break; + case orange: + attr = COLOR_PAIR(3); + } + attrset(attr); +} + +void paint_pac() +{ + attrset(COLOR_PAIR(3) | A_BOLD); +} + +void paint_hit() +{ + attrset(COLOR_PAIR(6)); +} + +void reset_attr() +{ + attrset(A_NORMAL); +} |