fprintf(stderr, "failed to allocate virtual framebuffer\n");
return 1;
}
+ vmem_front = vmem_back = fb_pixels;
SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER);
if(!(fbsurf = SDL_SetVideoMode(xsz, ysz, fb_bpp, sdl_flags))) {
quit = 1;
}
+void swap_buffers(void *pixels)
+{
+ /* do nothing, all pointers point to the same buffer */
+}
+
static void handle_event(SDL_Event *ev)
{
switch(ev->type) {
demo_keyboard(ev->key.keysym.sym, ev->key.state == SDL_PRESSED ? 1 : 0);
break;
+ case SDL_MOUSEMOTION:
+ mouse_x = ev->motion.x / fbscale;
+ mouse_y = ev->motion.y / fbscale;
+ break;
+
+ case SDL_MOUSEBUTTONDOWN:
+ mouse_bmask |= 1 << ev->button.button;
+ if(0) {
+ case SDL_MOUSEBUTTONUP:
+ mouse_bmask &= ~(1 << ev->button.button);
+ }
+ mouse_x = ev->button.x / fbscale;
+ mouse_y = ev->button.y / fbscale;
+ break;
+
default:
break;
}