Ignore:
Timestamp:
Nov 16, 2003, 1:09:09 AM (19 years ago)
Author:
Sam Hocevar
Message:
  • Very ugly ee_blit function. Will be polished in a while.
Location:
libcaca/trunk/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libcaca/trunk/test/Makefile.am

    r175 r183  
    1616demo_SOURCES = demo.c
    1717demo_LDADD = ../libee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm
     18demo_CFLAGS = `pkg-config --cflags gtk+-2.0`
     19demo_LDFLAGS = `pkg-config --libs gtk+-2.0`
    1820
    1921spritedit_SOURCES = spritedit.c
  • libcaca/trunk/test/demo.c

    r181 r183  
    2727#include <stdio.h>
    2828
     29#include <gdk/gdk.h>
     30#include <gdk/gdkpixbuf.h>
     31
    2932#include "ee.h"
    3033
     
    4043static void demo_triangles(void);
    4144static void demo_sprites(void);
     45static void demo_blit(void);
    4246
    4347int bounds = 0;
     
    4549struct ee_sprite *sprite = NULL;
    4650
     51GdkPixbuf *pixbuf;
     52char *pixels;
     53int bufx, bufy, bufpitch;
     54
    4755int main(int argc, char **argv)
    4856{
     
    5967    /* Initialize data */
    6068    sprite = ee_load_sprite("data/barboss.txt");
     69
     70gdk_init (&argc, &argv);
     71    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/gally4.jpeg", NULL);
     72    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/badge1.jpeg", NULL);
     73    //pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/union.png", NULL);
     74    pixbuf = gdk_pixbuf_new_from_file("/home/sam/pix/pikachu.jpeg", NULL);
     75if(!pixbuf) return -2;
     76    pixels = gdk_pixbuf_get_pixels(pixbuf);
     77    bufx = gdk_pixbuf_get_width(pixbuf);
     78    bufy = gdk_pixbuf_get_height(pixbuf);
     79    bufpitch = gdk_pixbuf_get_rowstride(pixbuf);
     80fprintf(stderr, "bits: %i\n", gdk_pixbuf_get_bits_per_sample(pixbuf));
     81fprintf(stderr, "w %i, h %i, stride %i\n", bufx, bufy, bufpitch);
    6182
    6283    /* Main menu */
     
    121142                demo = demo_sprites;
    122143                break;
     144            case 'i':
     145            case 'I':
     146                demo = demo_blit;
     147                break;
    123148            }
    124149
     
    174199    ee_putstr(4, 13, "'s': sprites");
    175200    ee_putstr(4, 14, "'c': color");
    176 
    177     ee_putstr(4, 16, "settings:");
    178     ee_printf(4, 17, "'o': outline: %s",
     201    ee_putstr(4, 15, "'i': image blit");
     202
     203    ee_putstr(4, 17, "settings:");
     204    ee_printf(4, 18, "'o': outline: %s",
    179205              outline == 0 ? "none" : outline == 1 ? "solid" : "thin");
    180     ee_printf(4, 18, "'b': drawing boundaries: %s",
     206    ee_printf(4, 19, "'b': drawing boundaries: %s",
    181207              bounds == 0 ? "screen" : "infinite");
    182208
     
    429455}
    430456
     457static void demo_blit(void)
     458{
     459ee_set_color(EE_LIGHTGRAY);
     460    ee_blit(6, 4, ee_get_width() - 6, ee_get_height() - 4, pixels, bufx, bufy);
     461}
     462
Note: See TracChangeset for help on using the changeset viewer.