Changeset 2986 for powerpipo/trunk
- Timestamp:
- Oct 18, 2008, 11:31:45 PM (14 years ago)
- Location:
- powerpipo/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
powerpipo/trunk/configure.ac
r2984 r2986 27 27 28 28 CACA="no" 29 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta 9,29 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15, 30 30 [CACA="yes"], 31 31 [AC_MSG_RESULT(no) 32 AC_MSG_ERROR([you need libcaca version 0.99.beta 9or later])])32 AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])]) 33 33 34 34 # Optimizations -
powerpipo/trunk/src/main.c
r1818 r2986 17 17 #include <stdio.h> 18 18 19 #include <c ucul.h>19 #include <caca.h> 20 20 #include <caca.h> 21 21 22 static void do_page(c ucul_canvas_t *, int);23 static void runtoilet(c ucul_canvas_t *, char const *, char const *);22 static void do_page(caca_canvas_t *, int); 23 static void runtoilet(caca_canvas_t *, char const *, char const *); 24 24 25 25 int main(int argc, char *argv[]) 26 26 { 27 27 caca_display_t *dp; 28 c ucul_canvas_t *cv;28 caca_canvas_t *cv; 29 29 int page = 0, npages = 10, changed = 1; 30 30 31 cv = c ucul_create_canvas(0, 0);31 cv = caca_create_canvas(0, 0); 32 32 33 33 dp = caca_create_display(cv); … … 79 79 end: 80 80 caca_free_display(dp); 81 c ucul_free_canvas(cv);81 caca_free_canvas(cv); 82 82 83 83 return 0; 84 84 } 85 85 86 static void do_page(c ucul_canvas_t *cv, int page)86 static void do_page(caca_canvas_t *cv, int page) 87 87 { 88 88 char str[BUFSIZ]; 89 c ucul_canvas_t *tmp;89 caca_canvas_t *tmp; 90 90 91 c ucul_clear_canvas(cv);92 tmp = c ucul_create_canvas(0, 0);91 caca_clear_canvas(cv); 92 tmp = caca_create_canvas(0, 0); 93 93 94 94 if(page < 1) goto end; 95 95 sprintf(str, "\x1b[33;93m» \x1b[37;97mEfficient presentations"); 96 96 runtoilet(tmp, "-f smmono12", str); 97 c ucul_blit(cv, 4, 0, tmp, NULL);97 caca_blit(cv, 4, 0, tmp, NULL); 98 98 99 99 if(page < 2) goto end; 100 100 sprintf(str, "\x1b[32;92m» \x1b[37;97mWhy text mode?"); 101 101 runtoilet(tmp, "-f smmono9", str); 102 c ucul_blit(cv, 11, 9, tmp, NULL);102 caca_blit(cv, 11, 9, tmp, NULL); 103 103 104 104 if(page < 3) goto end; 105 105 sprintf(str, "\x1b[32;92m» \x1b[37;97mExample: \x1b[34mp\x1b[35mo\x1b[36mw\x1b[32me\x1b[31mr\x1b[34mp\x1b[35mi\x1b[36mp\x1b[32mo\x1b[37m™"); 106 106 runtoilet(tmp, "-f smmono9", str); 107 c ucul_blit(cv, 11, 16, tmp, NULL);107 caca_blit(cv, 11, 16, tmp, NULL); 108 108 109 109 if(page < 4) goto end; 110 110 sprintf(str, "\x1b[33;93m» \x1b[37;97mAdvanced stuff"); 111 111 runtoilet(tmp, "-f smmono12", str); 112 c ucul_blit(cv, 4, 24, tmp, NULL);112 caca_blit(cv, 4, 24, tmp, NULL); 113 113 114 114 if(page < 5) goto end; 115 115 sprintf(str, "\x1b[32;92m» \x1b[37;97mTransition effects"); 116 116 runtoilet(tmp, "-f smmono9", str); 117 c ucul_blit(cv, 11, 34, tmp, NULL);117 caca_blit(cv, 11, 34, tmp, NULL); 118 118 119 119 if(page < 6) goto end; 120 120 sprintf(str, "\x1b[32;92m» \x1b[37;97mColor filters"); 121 121 runtoilet(tmp, "-f smmono9 --gay", str); 122 c ucul_blit(cv, 11, 41, tmp, NULL);122 caca_blit(cv, 11, 41, tmp, NULL); 123 123 124 124 if(page < 7) goto end; 125 125 sprintf(str, "\x1b[32;92m» \x1b[37;97mPictures and movies"); 126 126 runtoilet(tmp, "-f smmono9", str); 127 c ucul_blit(cv, 11, 48, tmp, NULL);127 caca_blit(cv, 11, 48, tmp, NULL); 128 128 129 129 if(page < 8) goto end; 130 130 sprintf(str, "\x1b[32;92m» \x1b[37;97mEmbedded applications"); 131 131 runtoilet(tmp, "-f smmono9", str); 132 c ucul_blit(cv, 11, 55, tmp, NULL);132 caca_blit(cv, 11, 55, tmp, NULL); 133 133 134 134 end: 135 c ucul_printf(cv, 0, 0, "page %i", page);135 caca_printf(cv, 0, 0, "page %i", page); 136 136 } 137 137 138 138 /* Warning: quotes are not safe */ 139 static void runtoilet(c ucul_canvas_t *cv, char const *options, char const *str)139 static void runtoilet(caca_canvas_t *cv, char const *options, char const *str) 140 140 { 141 141 char buf[BUFSIZ], cmd[BUFSIZ]; … … 143 143 int ret; 144 144 145 c ucul_set_canvas_size(cv, 0, 0);145 caca_set_canvas_size(cv, 0, 0); 146 146 147 147 sprintf(cmd, "toilet -w 1000 %s '%s'", options, str); … … 154 154 return; 155 155 156 ret = c ucul_import_memory(cv, buf, ret, "utf8");156 ret = caca_import_memory(cv, buf, ret, "utf8"); 157 157 if(ret <= 0) 158 158 return;
Note: See TracChangeset
for help on using the changeset viewer.