1 ;;; Copyright 2009-2011 Christoph Senjak
3 ;; various draw-methods
5 (in-package :uxul-world)
7 (defun draw-background (x-trans y-trans)
8 ;; (let ((ani3 (car (images (make-animation 0 |background_test_layer_3|))))
9 ;; (ani2 (car (images (make-animation 0 |background_test_layer_2|)))))
11 ;; (loop for i from -1 to 16
12 ;; do (loop for j from -1 to 12
14 ;; (sdl:draw-surface-at-* ani2
16 ;; (mod (/ x-trans 4) 64)))
18 ;; (mod (/ y-trans 4) 64)))))))
19 ;; (loop for i from -1 to 16
20 ;; do (loop for j from -1 to 12
22 ;; (sdl:draw-surface-at-* ani3
24 ;; (mod (/ x-trans 2) 64)))
26 ;; (mod (/ y-trans 2) 64)))))))
29 (defmethod draw ((obj room))
30 (let ((*current-translation-x*
31 (* (- +screen-width+ (x (graphic-centralizer obj)))))
32 (*current-translation-y*
33 (* (- +screen-height+ (y (graphic-centralizer obj))))))
34 (draw-background *current-translation-x* *current-translation-y*)
35 (gl:scale *zoomx* (- *zoomy*) 1)
36 (gl:translate *current-translation-x* *current-translation-y* 0)
37 (dolist (image (get-objects obj 'uxul-world::game-object))
38 (and (redraw image) (visible image) (draw image)))))
43 (defvar *player-bar-color* -255)
45 (defmethod draw ((obj player))
46 #+nil(if (rectangle-in-screen obj)
47 (old-draw-rectangle obj :r 255 :g 255 :b 255))
49 ;;; FIXME ************
51 ;; 10 10 (floor (* (power obj) (/ (- +screen-width+ 20) 10))) 10
52 ;; :color (sdl:color :r (abs *player-bar-color*) :g (abs *player-bar-color*) :b (abs *player-bar-color*)))
53 (incf *player-bar-color* 5)
54 (if (= *player-bar-color* 255) (setf *player-bar-color* -255))
58 (defmethod draw ((obj stone)) (call-next-method))
60 (defmethod draw ((obj simple-enemy)) (call-next-method))