Changeset 2986


Ignore:
Timestamp:
Oct 18, 2008, 11:31:45 PM (9 years ago)
Author:
sam
Message:

Port powerpipo to the unified libcaca 0.99.beta15 API.

Location:
powerpipo/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • powerpipo/trunk/configure.ac

    r2984 r2986  
    2727
    2828CACA="no"
    29 PKG_CHECK_MODULES(CACA, caca >= 0.99.beta9,
     29PKG_CHECK_MODULES(CACA, caca >= 0.99.beta15,
    3030 [CACA="yes"],
    3131 [AC_MSG_RESULT(no)
    32   AC_MSG_ERROR([you need libcaca version 0.99.beta9 or later])])
     32  AC_MSG_ERROR([you need libcaca version 0.99.beta15 or later])])
    3333
    3434# Optimizations
  • powerpipo/trunk/src/main.c

    r1818 r2986  
    1717#include <stdio.h>
    1818
    19 #include <cucul.h>
     19#include <caca.h>
    2020#include <caca.h>
    2121
    22 static void do_page(cucul_canvas_t *, int);
    23 static void runtoilet(cucul_canvas_t *, char const *, char const *);
     22static void do_page(caca_canvas_t *, int);
     23static void runtoilet(caca_canvas_t *, char const *, char const *);
    2424
    2525int main(int argc, char *argv[])
    2626{
    2727    caca_display_t *dp;
    28     cucul_canvas_t *cv;
     28    caca_canvas_t *cv;
    2929    int page = 0, npages = 10, changed = 1;
    3030
    31     cv = cucul_create_canvas(0, 0);
     31    cv = caca_create_canvas(0, 0);
    3232
    3333    dp = caca_create_display(cv);
     
    7979 end:
    8080    caca_free_display(dp);
    81     cucul_free_canvas(cv);
     81    caca_free_canvas(cv);
    8282
    8383    return 0;
    8484}
    8585
    86 static void do_page(cucul_canvas_t *cv, int page)
     86static void do_page(caca_canvas_t *cv, int page)
    8787{
    8888    char str[BUFSIZ];
    89     cucul_canvas_t *tmp;
     89    caca_canvas_t *tmp;
    9090
    91     cucul_clear_canvas(cv);
    92     tmp = cucul_create_canvas(0, 0);
     91    caca_clear_canvas(cv);
     92    tmp = caca_create_canvas(0, 0);
    9393
    9494    if(page < 1) goto end;
    9595    sprintf(str, "\x1b[33;93m» \x1b[37;97mEfficient presentations");
    9696    runtoilet(tmp, "-f smmono12", str);
    97     cucul_blit(cv, 4, 0, tmp, NULL);
     97    caca_blit(cv, 4, 0, tmp, NULL);
    9898
    9999    if(page < 2) goto end;
    100100    sprintf(str, "\x1b[32;92m» \x1b[37;97mWhy text mode?");
    101101    runtoilet(tmp, "-f smmono9", str);
    102     cucul_blit(cv, 11, 9, tmp, NULL);
     102    caca_blit(cv, 11, 9, tmp, NULL);
    103103
    104104    if(page < 3) goto end;
    105105    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™");
    106106    runtoilet(tmp, "-f smmono9", str);
    107     cucul_blit(cv, 11, 16, tmp, NULL);
     107    caca_blit(cv, 11, 16, tmp, NULL);
    108108
    109109    if(page < 4) goto end;
    110110    sprintf(str, "\x1b[33;93m» \x1b[37;97mAdvanced stuff");
    111111    runtoilet(tmp, "-f smmono12", str);
    112     cucul_blit(cv, 4, 24, tmp, NULL);
     112    caca_blit(cv, 4, 24, tmp, NULL);
    113113
    114114    if(page < 5) goto end;
    115115    sprintf(str, "\x1b[32;92m» \x1b[37;97mTransition effects");
    116116    runtoilet(tmp, "-f smmono9", str);
    117     cucul_blit(cv, 11, 34, tmp, NULL);
     117    caca_blit(cv, 11, 34, tmp, NULL);
    118118
    119119    if(page < 6) goto end;
    120120    sprintf(str, "\x1b[32;92m» \x1b[37;97mColor filters");
    121121    runtoilet(tmp, "-f smmono9 --gay", str);
    122     cucul_blit(cv, 11, 41, tmp, NULL);
     122    caca_blit(cv, 11, 41, tmp, NULL);
    123123
    124124    if(page < 7) goto end;
    125125    sprintf(str, "\x1b[32;92m» \x1b[37;97mPictures and movies");
    126126    runtoilet(tmp, "-f smmono9", str);
    127     cucul_blit(cv, 11, 48, tmp, NULL);
     127    caca_blit(cv, 11, 48, tmp, NULL);
    128128
    129129    if(page < 8) goto end;
    130130    sprintf(str, "\x1b[32;92m» \x1b[37;97mEmbedded applications");
    131131    runtoilet(tmp, "-f smmono9", str);
    132     cucul_blit(cv, 11, 55, tmp, NULL);
     132    caca_blit(cv, 11, 55, tmp, NULL);
    133133
    134134end:
    135     cucul_printf(cv, 0, 0, "page %i", page);
     135    caca_printf(cv, 0, 0, "page %i", page);
    136136}
    137137
    138138/* Warning: quotes are not safe */
    139 static void runtoilet(cucul_canvas_t *cv, char const *options, char const *str)
     139static void runtoilet(caca_canvas_t *cv, char const *options, char const *str)
    140140{
    141141    char buf[BUFSIZ], cmd[BUFSIZ];
     
    143143    int ret;
    144144
    145     cucul_set_canvas_size(cv, 0, 0);
     145    caca_set_canvas_size(cv, 0, 0);
    146146
    147147    sprintf(cmd, "toilet -w 1000 %s '%s'", options, str);
     
    154154        return;
    155155
    156     ret = cucul_import_memory(cv, buf, ret, "utf8");
     156    ret = caca_import_memory(cv, buf, ret, "utf8");
    157157    if(ret <= 0)
    158158        return;
Note: See TracChangeset for help on using the changeset viewer.