From cd038fc15dd9a1bcaab064c605a4df1f11488cab Mon Sep 17 00:00:00 2001 From: Boutade Date: Thu, 17 Oct 2019 12:19:39 -0500 Subject: backdrop etc --- the-price-of-a-cup-of-coffee.lisp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'the-price-of-a-cup-of-coffee.lisp') diff --git a/the-price-of-a-cup-of-coffee.lisp b/the-price-of-a-cup-of-coffee.lisp index f70161a..2038c18 100644 --- a/the-price-of-a-cup-of-coffee.lisp +++ b/the-price-of-a-cup-of-coffee.lisp @@ -5,8 +5,8 @@ (defparameter +window-width+ 1024) (defparameter +window-height+ 600) (defparameter +meter-bar-height+ 16) -(defparameter +vert-min+ 16) -(defparameter +vert-max+ (- +window-height+ 128 10)) +(defparameter +vert-min+ 24) +(defparameter +vert-max+ (- +window-height+ 128 30)) (defparameter +frame-delay+ (round (/ 1000 60))) (defvar *nance*) @@ -91,6 +91,7 @@ (defvar *cold-meter* (make-instance 'status-meter :color (list 0 140 240 200) + :decoration "cold" :filled-shape (sdl2:make-rect (+ padding (* 4 measure)) padding 1 +meter-bar-height+) :shape (sdl2:make-rect (+ padding (* 4 measure)) padding width +meter-bar-height+) :percent 0.0 @@ -216,13 +217,11 @@ (setf (sick-p hero) nil) (setf (walk-speed hero) (* 2 (walk-speed hero))))) - (defmethod update :after ((hero hero) ticks) (with-slots (pos) hero (setf (sdl2:rect-x pos) (mod (sdl2:rect-x pos) +window-width+)))) - (def-normal-class pedestrian (human) (comfort-rad 60) (react-per-sec 4) @@ -268,8 +267,6 @@ suit)) - - (defun boot-up (renderer) ;; cleanup from previous calls to start - used while testing (setf *pedestrians* nil) @@ -289,8 +286,23 @@ (push (car *pedestrians*) *to-render-by-y*)) +(defun stop-and-consider (pedestrian)) + ;; (with-slots (walk-vec expression anger kindness generosity vulnerability) pedestrian + ;; (incf (percent *stress-meter*) vulnerability) + ;; (let ((old-vec (copy-list walk-vec))) + ;; (setf (car walk-vec) 0) + ;; (setf (cdr walk-vec) 0) + ;; (cond + ;; ((cointoss anger) (emote pedestrian "angry") + (defun action-key-pressed () - (print "Action")) + (let-if (mark (find-if (lambda (ped) + (< (dist ped *nance*) + (* 0.5 (comfort-rad ped)))) + *pedestrians*)) + (stop-and-consider mark) + (incf (percent *stress-meter*) 0.01))) + (defun any-p (arg &rest preds) (and preds @@ -430,6 +442,7 @@ (defun handle-keyup (keysym) (let ((key (sdl2:scancode-value keysym))) (match-key key + (:scancode-space (setf (keys-down-action *keys-down*) nil)) (:scancode-left (setf (keys-down-left *keys-down*) nil) (rem-walk-hero-left)) @@ -515,6 +528,10 @@ (sdl2:set-render-draw-color renderer 80 80 80 255) (sdl2:render-clear renderer) + (sdl2:render-copy renderer *backdrop-texture*) + (sdl2:render-copy renderer *sliding-door-texture* + :dest-rect *sliding-door-position*) + ;; render characters and other objects (setf *to-render-by-y* (sort *to-render-by-y* #'< :key #'y-pos)) -- cgit v1.2.3