diff --git a/14/tutorial-14.lisp b/14-animated-sprites-and-vsync.lisp similarity index 89% rename from 14/tutorial-14.lisp rename to 14-animated-sprites-and-vsync.lisp index 05def6b..428617a 100644 --- a/14/tutorial-14.lisp +++ b/14-animated-sprites-and-vsync.lisp @@ -1,8 +1,9 @@ -(defpackage #:sdl2-tutorial-14 - (:use :common-lisp) - (:export :main)) +(defpackage #:sdl2-tutorial-14-animated-sprites-and-vsync + (:use :cl) + (:export :run) + (:import-from :sdl2-tutorial-utils :asset-pathname)) -(in-package :sdl2-tutorial-14) +(in-package #:sdl2-tutorial-14-animated-sprites-and-vsync) (defparameter *screen-width* 640) (defparameter *screen-height* 480) @@ -54,7 +55,7 @@ (defmacro with-window-renderer ((window renderer) &body body) `(sdl2:with-init (:video) (sdl2:with-window (,window - :title "SDL2 Tutorial" + :title "SDL2 Tutorial 14" :w *screen-width* :h *screen-height* :flags '(:shown)) @@ -70,10 +71,10 @@ (defmacro clamp-decf (x delta) `(setf ,x (clamp (- ,x ,delta)))) -(defun main() +(defun run () (with-window-renderer (window renderer) (sdl2-image:init '(:png)) - (let ((spritesheet-tex (load-texture-from-file renderer "14/character.png")) + (let ((spritesheet-tex (load-texture-from-file renderer (asset-pathname "assets/14/character.png"))) (clip (sdl2:make-rect 0 0 64 96)) (sprite-frames 4) (current-sprite-frame 0) diff --git a/14/character.png b/assets/14/character.png similarity index 100% rename from 14/character.png rename to assets/14/character.png diff --git a/sdl2-tutorial.asd b/sdl2-tutorial.asd index eecee57..70f1883 100644 --- a/sdl2-tutorial.asd +++ b/sdl2-tutorial.asd @@ -18,7 +18,7 @@ (:file "11-clip-rendering-and-sprite-sheets") (:file "12-color-modulation") (:file "13-alpha-blending") - (:file "14/tutorial-14") + (:file "14-animated-sprites-and-vsync") (:file "15/tutorial-15") (:file "16/tutorial-16")) :in-order-to ((test-op (test-op "sdl2-tutorial/tests"))))