nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include nuclear@0: #include "gfx.h" nuclear@0: #include "image.h" nuclear@0: #include "logger.h" nuclear@0: nuclear@0: nuclear@0: static int proc_event(union gfx_event *ev); nuclear@0: nuclear@0: int main(int argc, char **argv) nuclear@0: { nuclear@7: int i; nuclear@7: unsigned int flags = 0; nuclear@7: const char *fname = 0; nuclear@0: struct ham_image *img; nuclear@0: nuclear@7: for(i=1; iwidth, img->height, nuclear@7: img->nbitplanes, img->ham ? " (HAM)" : ""); nuclear@0: } else { nuclear@0: printf("generating test image ...\n"); nuclear@0: if(!(img = gen_ham_image(320, 256, 6))) { nuclear@0: fprintf(stderr, "failed to generate image\n"); nuclear@0: return 1; nuclear@0: } nuclear@0: } nuclear@0: nuclear@7: if(img->nbitplanes >= 6) img->ham = 1; /* XXX */ nuclear@7: if(img->ham) flags |= GFX_HAM; nuclear@7: nuclear@7: if(gfx_init(img->nbitplanes, flags) == -1) { nuclear@0: return 1; nuclear@0: } nuclear@7: gfx_set_framebuffer(0, img->width, img->height); nuclear@0: gfx_wait_vblank(); nuclear@3: gfx_show_image(img); nuclear@0: nuclear@0: for(;;) { nuclear@0: union gfx_event ev; nuclear@0: if(gfx_next_event(&ev, GFX_EVLOOP_BLOCK)) { nuclear@0: if(proc_event(&ev) == -1) { nuclear@0: break; nuclear@0: } nuclear@0: } nuclear@0: } nuclear@0: nuclear@0: gfx_shutdown(); nuclear@0: return 0; nuclear@0: } nuclear@0: nuclear@0: static int proc_event(union gfx_event *ev) nuclear@0: { nuclear@0: switch(ev->type) { nuclear@0: case GFX_EV_QUIT: nuclear@0: return -1; nuclear@0: nuclear@0: case GFX_EV_KEY: nuclear@0: switch(ev->key.key) { nuclear@0: case 27: nuclear@0: return -1; nuclear@0: default: nuclear@0: break; nuclear@0: } nuclear@0: break; nuclear@0: nuclear@0: default: nuclear@0: break; nuclear@0: } nuclear@0: return 0; nuclear@0: }