if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION,
\"Failed to init %s\",
SDL_GetError());
" (error "failed to SDL_Init(video)") "
}
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 "failed to create window and renderer") "
}
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;
(defmacro funcall-on-2 (function (&rest vars) form)
`(lambda ()
,@(loop for var in vars collect
`(,function ,var ,form))))
(defun play ()
(game ((a 100) (b 200) (c 300) (d 400))
((:int a b c d))
(funcall-on-2 incf (a b c d) (1- (random 3)))
;; This would copy the variables, and end up doing nothing:
#| and is hence commented out.
(lambda ()
(loop for var in (list a b c d)
do (incf var (1- (random 3)))))
|#
(colorer 255 10 10 255)
(line-drawer a b c d)
(colorer 0 255 100 255)
(line-drawer 0 100 100 111)))