From d972c27613455e8ca583540603bc00b24ec866eb Mon Sep 17 00:00:00 2001 From: Boutade Date: Fri, 18 Oct 2019 18:50:21 -0500 Subject: added soem fade outs --- the-price-of-a-cup-of-coffee.lisp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp index a48d4d5..5e51f17 100644 --- a/the-price-of-a-cup-of-coffee.lisp +++ b/the-price-of-a-cup-of-coffee.lisp @@ -449,7 +449,8 @@ (defun action-key-pressed () (cond - ((and (in-front-of-door-p) + ((and (not *on-coffee-break*) + (in-front-of-door-p) (eql 'facing-up (face *nance*)) (enough-for-coffee-p)) (get-coffee!)) @@ -695,6 +696,18 @@ +(defparameter +screen-sized-rect+ (sdl2:make-rect 0 0 +window-width+ +window-height+)) +(defvar *fading-out* nil) + +(defun fade-out () + (setf *fading-out* (list 0)) + (push (animate *fading-out* 'car 255 :start (sdl2:get-ticks) :duration 3000) + *tweens*)) + +(defun end-fade-out () + (setf *fading-out* (list 0)) + (push (animate *fading-out* 'car 220 :start (sdl2:get-ticks) :duration 15000) + *tweens*)) (defmethod render ((game (eql :game)) renderer) ;; clear screen @@ -717,6 +730,10 @@ (render *stress-meter* renderer) (render *cold-meter* renderer) + (when *fading-out* + (sdl2:set-render-draw-color renderer 0 0 0 (car *fading-out*)) + (sdl2:render-fill-rect renderer +screen-sized-rect+)) + ;; present (sdl2:render-present renderer)) -- cgit v1.2.3