Changeset 183 for libcaca/trunk/test
- Timestamp:
- Nov 16, 2003, 1:09:09 AM (19 years ago)
- Location:
- libcaca/trunk/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
libcaca/trunk/test/Makefile.am
r175 r183 16 16 demo_SOURCES = demo.c 17 17 demo_LDADD = ../libee/libee.a $(LDFLAGS_slang) $(LDFLAGS_ncurses) -lm 18 demo_CFLAGS = `pkg-config --cflags gtk+-2.0` 19 demo_LDFLAGS = `pkg-config --libs gtk+-2.0` 18 20 19 21 spritedit_SOURCES = spritedit.c -
libcaca/trunk/test/demo.c
r181 r183 27 27 #include <stdio.h> 28 28 29 #include <gdk/gdk.h> 30 #include <gdk/gdkpixbuf.h> 31 29 32 #include "ee.h" 30 33 … … 40 43 static void demo_triangles(void); 41 44 static void demo_sprites(void); 45 static void demo_blit(void); 42 46 43 47 int bounds = 0; … … 45 49 struct ee_sprite *sprite = NULL; 46 50 51 GdkPixbuf *pixbuf; 52 char *pixels; 53 int bufx, bufy, bufpitch; 54 47 55 int main(int argc, char **argv) 48 56 { … … 59 67 /* Initialize data */ 60 68 sprite = ee_load_sprite("data/barboss.txt"); 69 70 gdk_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); 75 if(!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); 80 fprintf(stderr, "bits: %i\n", gdk_pixbuf_get_bits_per_sample(pixbuf)); 81 fprintf(stderr, "w %i, h %i, stride %i\n", bufx, bufy, bufpitch); 61 82 62 83 /* Main menu */ … … 121 142 demo = demo_sprites; 122 143 break; 144 case 'i': 145 case 'I': 146 demo = demo_blit; 147 break; 123 148 } 124 149 … … 174 199 ee_putstr(4, 13, "'s': sprites"); 175 200 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", 179 205 outline == 0 ? "none" : outline == 1 ? "solid" : "thin"); 180 ee_printf(4, 1 8, "'b': drawing boundaries: %s",206 ee_printf(4, 19, "'b': drawing boundaries: %s", 181 207 bounds == 0 ? "screen" : "infinite"); 182 208 … … 429 455 } 430 456 457 static void demo_blit(void) 458 { 459 ee_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.