]> git.mdlowis.com Git - archive/afm.git/commitdiff
IMPORTANT THINGS
authora bellenir <a@bellenir.com>
Mon, 28 Jul 2014 09:39:03 +0000 (09:39 +0000)
committera bellenir <a@bellenir.com>
Mon, 28 Jul 2014 09:39:03 +0000 (09:39 +0000)
source/aardvark.c
source/main.c
source/state.c

index a9ebcdf5bc315793b06d5202d521b9562230649d..2d6b1c08ee200b6f32dff765d77e32677ab29afc 100644 (file)
@@ -25,14 +25,18 @@ static Triplet_T aadata[77] = {
     { 26, 18,  8 }, { 26, 27, 15 }, { 26, 49,  7 }, { 27, 26,  6 }
 };
 
+static int c = 0;
 void aardvark_draw(void) {
     int row, col;
     int i;
     int trips=sizeof(aadata)/sizeof(Triplet_T);
     char* aardvark="############################################################";
     getmaxyx(stdscr, row, col);
+    attron(COLOR_PAIR(c));
     for(i=0; i<trips; i++)
         mvaddnstr(((row-28)/2)+aadata[i].a, (col-70)/2+aadata[i].b, aardvark, aadata[i].c);
+    attroff(COLOR_PAIR(c));
     refresh();
+    c = ((c+1)%7);
 }
 
index 1d2abb24ae3c6e11ed5fe4c152274ad778593e5b..456a25b1c94fc5b61b0aaf2837836ca1b28459e0 100644 (file)
@@ -4,23 +4,36 @@
 #include <signal.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "state.h"
 #include "input.h"
 #include "screen.h"
+#include "aardvark.h"
 
 void handle_signal(int sig) {
     state_set_screen_dirty(true);
     state_set_screen_resized(true);
 }
 
+void handle_alarm(int sig) {
+       aardvark_draw();
+       alarm(1);
+}
+
 int main(int argc, char** argv) {
     /* Handle terminal resizing */
     signal(SIGWINCH, handle_signal);
+    signal(SIGALRM, handle_alarm);
     /* Initialize ncurses and user input settings */
     initscr();
     start_color();
     init_pair(DIRECTORY, COLOR_BLUE, COLOR_BLACK);
+    init_pair(2, COLOR_MAGENTA, COLOR_BLACK);
+    init_pair(3, COLOR_RED, COLOR_BLACK);
+    init_pair(4, COLOR_YELLOW, COLOR_BLACK);
+    init_pair(5, COLOR_GREEN, COLOR_BLACK);
+    init_pair(6, COLOR_CYAN, COLOR_BLACK);
     raw();
     keypad(stdscr, TRUE);
     noecho();
index 92ae3692d9fe77f1f7aff3669dd9b60d37767309..8fc9376dca06bc1d6c79d253aa5cab2a72fc2541 100644 (file)
@@ -1,5 +1,6 @@
 /* TODO: fix list.h */
 #include <stddef.h> // needed because of a bug in list.h: size_t undefined.
+#include <unistd.h>
 #include "list.h"
 
 #include "frame.h"
@@ -52,6 +53,7 @@ bool state_get_aardvark_mode(void) {
 }
 
 void state_set_aardvark_mode(bool val) {
+       alarm(val ? 1 : 0);
     AardvarkOn = val;
 }