From: Christoph Senjak Date: Fri, 10 Apr 2009 21:09:04 +0000 (+0200) Subject: Added "convert-surface" for graphic loading X-Git-Url: http://uxul.de/gitweb/?a=commitdiff_plain;h=93cc969822df3b2a8c8f20809b2e8170d271f640;p=uxul-world.git Added "convert-surface" for graphic loading Now the graphic is reasonably fast on my laptop Added a simple (ugly, psychodelic) Background, just for testing-purposes. It looks ok and works fast enough. --- diff --git a/BUGS b/BUGS index 3e3a2a1..6d624d6 100644 --- a/BUGS +++ b/BUGS @@ -1,3 +1,3 @@ -2009/04/01 Background is too slow and "Jumps" +2009/04/09 Setting the Animation of Jumping doesnt always work correct -2009/04/09 Setting the Animation of Jumping doesnt always work correct \ No newline at end of file +2009/04/10 Random numeric type-errors diff --git a/README b/README index 6e0eaf2..7e933d9 100644 --- a/README +++ b/README @@ -1,3 +1,12 @@ This Game is under development and may not be ready to use yet. -It depends on Lispbuilder-SDL (SVN-Revision 759), LTK and lisp-magick. +It depends on Lispbuilder-SDL (SVN-Revision 759 should work), LTK and lisp-magick. + +To start the leveleditor, do (level-editor), it will return a sequence. Save this sequence +somewhere, say *a*. Then to play it, hit + +(start-game :room-function #'(lambda () (create-room-from-item-list *a*))) + +To edit *a* again, do (level-editor *a*), and your edited level will be returned. + +I cant promis that all revisions I will make will work. diff --git a/animation.lisp b/animation.lisp index db6c7bf..20fce5b 100755 --- a/animation.lisp +++ b/animation.lisp @@ -114,8 +114,8 @@ images-variable." (make-instance 'animation :images (mapcar #'(lambda (x) - (sdl-image:load-image + (sdl:convert-surface :surface (sdl-image:load-image x - :image-type :PNG :alpha 1 )) + :image-type :PNG :alpha 1 ))) image-list) :sprite-delay frame-skip)) \ No newline at end of file diff --git a/background_test_layer_1.png b/background_test_layer_1.png new file mode 100644 index 0000000..90ee99f Binary files /dev/null and b/background_test_layer_1.png differ diff --git a/background_test_layer_2.png b/background_test_layer_2.png new file mode 100644 index 0000000..518b75e Binary files /dev/null and b/background_test_layer_2.png differ diff --git a/background_test_layer_3.png b/background_test_layer_3.png new file mode 100644 index 0000000..5d88605 Binary files /dev/null and b/background_test_layer_3.png differ diff --git a/compile.cl b/compile.cl deleted file mode 100755 index ec06f57..0000000 --- a/compile.cl +++ /dev/null @@ -1,15 +0,0 @@ -#! /usr/bin/sbcl --script - -(clc:clc-require :uxul-world) - -(uxul-world:init-media) - -(sb-ext:save-lisp-and-die "coredump" - :executable - t - :toplevel - #'(lambda (x) - (unwind-protect - (uxul-world::start-game #'uxul-world::make-testing-room) - 0))) - diff --git a/draw.lisp b/draw.lisp index c2a3154..03a40b8 100755 --- a/draw.lisp +++ b/draw.lisp @@ -5,42 +5,25 @@ (in-package :uxul-world) (defun draw-background (x-trans y-trans) - - - (flet ((modf (x y) - (if nil ;(< x 0) - (- y (mod x y)) - (mod x y)))) - - - #|(sdl:draw-rectangle-* (+ 100 (ceiling (/ (mod x-trans 800) 2))) (+ 100 (ceiling (/ (mod y-trans 800) 2))) 400 400 - :color (sdl:color :r 255 :g 255 :b 255))|# - ;; layer -1 - - ;; HAAAAAAAAAAAAACK - (incf x-trans (- 10000 300)) - (incf x-trans (- 10000 300)) - - (dolist (i '(8 9 10 11 12 13 14 15 16 17 18 19 20)) - (dolist (j '(8 9 10 11 12 13 14 15 16 17 18 19 20)) - (sdl:draw-box-* (+ (- +screen-width+) (* 100 i) (round (/ (modf x-trans (* 2 +screen-width+)) 16))) (+ (- +screen-width+) (* 100 j) (ceiling (/ (modf y-trans (* 2 +screen-height+)) 16))) 50 50 - :color (sdl:color :r (+ 128 64) :g (+ 128 64) :b (+ 128 64)))) :fill t) - - (dolist (i '(4 5 6 7 8 9)) - (dolist (j '(4 5 6 7 8 9)) - (sdl:draw-box-* (+ (- +screen-width+) (* 200 i) (round (/ (modf x-trans (* 2 +screen-width+)) 8))) (+ (- +screen-width+) (* 200 j) (ceiling (/ (modf y-trans (* 2 +screen-height+)) 8))) 100 100 - :color (sdl:color :r 128 :g 128 :b 128))) :fill t) - (dolist (i '(2 3 4 5)) - (dolist (j '(2 3 4 5)) - (sdl:draw-box-* (+ (- +screen-width+) (* 400 i) (round (/ (modf x-trans (* 2 +screen-width+)) 4))) (+ (- +screen-width+) (* 400 j) (ceiling (/ (modf y-trans (* 2 +screen-height+)) 4))) 200 200 - :color (sdl:color :r 64 :g 64 :b 64))) :fill t) - (dotimes (i 4) - (dotimes (j 4) - (sdl:draw-box-* (+ (- +screen-width+) (* 800 i) (round (/ (modf x-trans (* 2 +screen-width+)) 2))) (+ (- +screen-width+) (* 800 j) (ceiling (/ (modf y-trans (* 2 +screen-height+)) 2))) 400 400 - :color (sdl:color :r 0 :g 0 :b 0))) :fill t))) - - - + (let ((ani3 (car (images (make-animation 0 |background_test_layer_3|)))) + (ani2 (car (images (make-animation 0 |background_test_layer_2|))))) + + (loop for i from -1 to 16 + do (loop for j from -1 to 12 + do (progn + (sdl:draw-surface-at-* ani2 + (+ (* i 64) (round + (mod (/ x-trans 4) 64))) + (+ (* j 64) (round + (mod (/ y-trans 4) 64))))))) + (loop for i from -1 to 16 + do (loop for j from -1 to 12 + do + (sdl:draw-surface-at-* ani3 + (+ (* 64 i) (round + (mod (/ x-trans 2) 64))) + (+ (* 64 j) (round + (mod (/ y-trans 2) 64)))))))) (defmethod draw ((obj room)) (let ((*current-translation-x* @@ -61,7 +44,7 @@ (- 300 (y (graphic-centralizer obj)))))|# (- 300 (y (graphic-centralizer obj))) )) - ;;(draw-background *current-translation-x* *current-translation-y*) + (draw-background *current-translation-x* *current-translation-y*) (dolist (image (get-objects obj 'uxul-world::game-object)) (if (and (redraw image) (visible image)) (draw image))))) @@ -91,4 +74,4 @@ (defmethod draw ((obj simple-enemy)) (call-next-method) #+nil(if (rectangle-in-screen obj) - (old-draw-rectangle obj :r 255 :g 255 :b 255))) \ No newline at end of file + (old-draw-rectangle obj :r 255 :g 255 :b 255)))