From 8041d52f572a16b13936ac0051360361333694d1 Mon Sep 17 00:00:00 2001 From: TatriX Date: Sun, 19 Sep 2021 11:07:32 +0200 Subject: [PATCH] Refactor tutorial 12 --- 12/tutorial-12.lisp => 12-color-modulation.lisp | 15 ++++++++------- {12 => assets/12}/texture.png | Bin sdl2-tutorial.asd | 2 +- 3 files changed, 9 insertions(+), 8 deletions(-) rename 12/tutorial-12.lisp => 12-color-modulation.lisp (89%) rename {12 => assets/12}/texture.png (100%) diff --git a/12/tutorial-12.lisp b/12-color-modulation.lisp similarity index 89% rename from 12/tutorial-12.lisp rename to 12-color-modulation.lisp index d6c803f..bcfa908 100644 --- a/12/tutorial-12.lisp +++ b/12-color-modulation.lisp @@ -1,8 +1,9 @@ -(defpackage #:sdl2-tutorial-12 - (:use :common-lisp) - (:export :main)) +(defpackage #:sdl2-tutorial-12-color-modulation + (:use :cl) + (:export :run) + (:import-from :sdl2-tutorial-utils :asset-pathname)) -(in-package :sdl2-tutorial-12) +(in-package #:sdl2-tutorial-12-color-modulation) (defparameter *screen-width* 640) (defparameter *screen-height* 480) @@ -48,7 +49,7 @@ (defmacro with-window-renderer ((window renderer) &body body) `(sdl2:with-init (:video) (sdl2:with-window (,window - :title "SDL2 Tutorial" + :title "SDL2 Tutorial 12" :w *screen-width* :h *screen-height* :flags '(:shown)) @@ -64,10 +65,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 ((texture (load-texture-from-file renderer "12/texture.png")) + (let ((texture (load-texture-from-file renderer (asset-pathname #P"assets/12/texture.png"))) (r 255) (g 255) (b 255) diff --git a/12/texture.png b/assets/12/texture.png similarity index 100% rename from 12/texture.png rename to assets/12/texture.png diff --git a/sdl2-tutorial.asd b/sdl2-tutorial.asd index ccf7e90..ec6a897 100644 --- a/sdl2-tutorial.asd +++ b/sdl2-tutorial.asd @@ -16,7 +16,7 @@ (:file "09-the-viewport") (:file "10-color-keying") (:file "11-clip-rendering-and-sprite-sheets") - (:file "12/tutorial-12") + (:file "12-color-modulation") (:file "13/tutorial-13") (:file "14/tutorial-14") (:file "15/tutorial-15")