diff options
author | Boutade <thegoofist@protonmail.com> | 2019-10-18 18:50:21 -0500 |
---|---|---|
committer | Boutade <thegoofist@protonmail.com> | 2019-10-18 18:50:21 -0500 |
commit | d972c27613455e8ca583540603bc00b24ec866eb (patch) | |
tree | 49ed5738595d283169a028377070068b7ed98e23 | |
parent | 6997cd0c7a678647fa012685f9ed27816ade8e06 (diff) |
added soem fade outs
-rw-r--r-- | the-price-of-a-cup-of-coffee.lisp | 19 |
1 files changed, 18 insertions, 1 deletions
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)) |