(ffi:clines " #include SDL_Renderer *renderer; SDL_Window *window; SDL_Event e; const Uint8 *state; int quitted; int up_arrow, down_arrow, left_arrow, right_arrow; ") (defun fill-rect (r g b x y w h) (ffi:c-inline (r g b x y w h) (:int :int :int :int :int :int :int) nil " SDL_SetRenderDrawColor(renderer,#0,#1,#2,255); SDL_RenderFillRect(renderer, &(struct SDL_Rect){.x = #3, .y = #4, .w = #5, .h = #6}); SDL_SetRenderDrawColor(renderer,0,0,0,255); ")) (unwind-protect (ffi:c-progn () " if (SDL_Init(SDL_INIT_VIDEO) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \"Failed to init %s\", SDL_GetError()); " (error "SDL init error") " } if (SDL_CreateWindowAndRenderer(640,480,SDL_WINDOW_RESIZABLE, &window, &renderer)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \"Failed to create w & r%s\", SDL_GetError()); " (error "SDL create window error") " } quitted = 0; for (;;) { while(SDL_PollEvent(&e)) if (e.type == SDL_QUIT) quitted = 1; else if (e.type == SDL_KEYDOWN) switch (e.key.keysym.sym) { case SDLK_q: quitted = 1; break; } if (quitted) break; SDL_RenderClear(renderer); " (fill-rect 100 200 255 100 200 300 400) " SDL_RenderPresent(renderer); SDL_Delay(25); }") (ffi:c-inline () () nil "SDL_Quit()" :one-liner t)) (si:quit)