Changeset 217


Ignore:
Timestamp:
Nov 24, 2003, 8:56:04 PM (16 years ago)
Author:
Sam Hocevar
Message:
  • configure.ac examples/Makefile.am: + Added a check for imlib2-config. + Build cacaview conditionally.
  • examples/demo.c: + Removed all gdkpixbuf code.
  • examples/view.c: + Default to ordered dithering. + Make sure the arrows always work even if delta is too small.
Location:
libcaca/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/configure.ac

    r207 r217  
    7171AM_CONDITIONAL(NEED_PIC, ${NEED_PIC})
    7272
     73# Build cacaview?
     74AC_PATH_PROG(IMLIB2_CONFIG, imlib2-config, no)
     75AM_CONDITIONAL(IMLIB2_CONFIG, test "${IMLIB2_CONFIG}" != "no")
     76
    7377# Build documentation?
    7478AC_PATH_PROG(DOXYGEN, doxygen, no)
  • libcaca/trunk/examples/Makefile.am

    r215 r217  
    1414endif
    1515
    16 bin_PROGRAMS = cacademo caca-spritedit cacaview
     16bin_PROGRAMS = cacademo caca-spritedit $(cacaview)
    1717
    1818cacademo_SOURCES = demo.c
     
    2424caca_spritedit_CPPFLAGS = -I$(top_srcdir)/src
    2525
     26if IMLIB2_CONFIG
     27cacaview = cacaview
    2628cacaview_SOURCES = view.c
    27 cacaview_LDADD = ../src/libcaca.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm
     29cacaview_LDADD = ../src/libcaca.a $(LDFLAGS_slang) $(LDFLAGS_ncurses)
    2830cacaview_CPPFLAGS = -I$(top_srcdir)/src
    2931cacaview_CFLAGS = `imlib2-config --cflags`
    3032cacaview_LDFLAGS = `imlib2-config --libs`
     33endif
     34
  • libcaca/trunk/examples/demo.c

    r213 r217  
    2828#include <stdio.h>
    2929
    30 #if 0
    31 #include <gdk/gdk.h>
    32 #include <gdk/gdkpixbuf.h>
    33 #endif
    34 
    3530#include "caca.h"
    3631
     
    4641static void demo_triangles(void);
    4742static void demo_sprites(void);
    48 #if 0
    49 static void demo_blit(void);
    50 #endif
    5143
    5244int bounds = 0;
     
    5547struct caca_sprite *sprite = NULL;
    5648
    57 #if 0
    58 GdkPixbuf *pixbuf;
    59 char *pixels;
    60 int bufx, bufy, bufpitch;
    61 #endif
    62 
    6349int main(int argc, char **argv)
    6450{
     
    6753
    6854    if(caca_init())
    69     {
    7055        return 1;
    71     }
    7256
    7357    caca_set_delay(40000);
     
    7963    if(!sprite)
    8064        sprite = caca_load_sprite("examples/caca.txt");
    81 
    82 #if 0
    83 gdk_init (&argc, &argv);
    84     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/gally4.jpeg", NULL);
    85     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/badge1.jpeg", NULL);
    86     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/union.png", NULL);
    87     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/pikachu.jpeg", NULL);
    88     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/gradient.png", NULL);
    89     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/beastie.png", NULL);
    90     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/stitch.jpg", NULL);
    91     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/caca.jpg", NULL);
    92     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/dranac.jpeg", NULL);
    93     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/artwork/aboire.png", NULL);
    94     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/web/sam.zoy.org/artwork/goret.png", NULL);
    95     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/lilkim02.jpg", NULL);
    96     //pixbuf = gdk_pixbuf_new_from_file("/home/sam/etw.bmp", NULL);
    97     pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/lena_std.png", NULL);
    98 if(!pixbuf) return -2;
    99     pixels = gdk_pixbuf_get_pixels(pixbuf);
    100     bufx = gdk_pixbuf_get_width(pixbuf);
    101     bufy = gdk_pixbuf_get_height(pixbuf);
    102     bufpitch = gdk_pixbuf_get_rowstride(pixbuf);
    103 fprintf(stderr, "bits: %i\n", gdk_pixbuf_get_bits_per_sample(pixbuf));
    104 fprintf(stderr, "w %i, h %i, stride %i\n", bufx, bufy, bufpitch);
    105 #endif
     65    if(!sprite)
     66        return 1;
    10667
    10768    /* Main menu */
     
    174135                demo = demo_sprites;
    175136                break;
    176 #if 0
    177             case 'i':
    178             case 'I':
    179                 demo = demo_blit;
    180                 break;
    181 #endif
    182137            }
    183138
     
    243198    caca_putstr(4, 13, "'s': sprites");
    244199    caca_putstr(4, 14, "'c': color");
    245 #if 0
    246     caca_putstr(4, 15, "'i': image blit");
    247 #endif
    248200
    249201    caca_putstr(4, 17, "settings:");
     
    503455}
    504456
    505 #if 0
    506 static void demo_blit(void)
    507 {
    508     caca_blit(6, 4, caca_get_width() - 6, caca_get_height() - 4,
    509               pixels, bufx, bufy);
    510 }
    511 #endif
    512 
  • libcaca/trunk/examples/view.c

    r215 r217  
    3535struct caca_bitmap *bitmap = NULL;
    3636
    37 int dithering = 0;
     37int dithering = 1;
    3838const enum caca_dithering dithering_list[] =
    3939    { CACA_DITHER_NONE, CACA_DITHER_ORDERED, CACA_DITHER_RANDOM };
     
    110110                break;
    111111            case CACA_EVENT_KEY_PRESS | CACA_KEY_UP:
    112                 if(zoom > 0) y -= h / (2 + zoom) / 8;
     112                if(zoom > 0) y -= 1 + h / (2 + zoom) / 8;
    113113                update = 1;
    114114                break;
    115115            case CACA_EVENT_KEY_PRESS | CACA_KEY_DOWN:
    116                 if(zoom > 0) y += h / (2 + zoom) / 8;
     116                if(zoom > 0) y += 1 + h / (2 + zoom) / 8;
    117117                update = 1;
    118118                break;
    119119            case CACA_EVENT_KEY_PRESS | CACA_KEY_LEFT:
    120                 if(zoom > 0) x -= w / (2 + zoom) / 8;
     120                if(zoom > 0) x -= 1 + w / (2 + zoom) / 8;
    121121                update = 1;
    122122                break;
    123123            case CACA_EVENT_KEY_PRESS | CACA_KEY_RIGHT:
    124                 if(zoom > 0) x += w / (2 + zoom) / 8;
     124                if(zoom > 0) x += 1 + w / (2 + zoom) / 8;
    125125                update = 1;
    126126                break;
Note: See TracChangeset for help on using the changeset viewer.