Skip to content

Commit

Permalink
Refactor tutorial 12
Browse files Browse the repository at this point in the history
  • Loading branch information
TatriX committed Sep 19, 2021
1 parent 401c62d commit 8041d52
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions 12/tutorial-12.lisp → 12-color-modulation.lisp
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -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))
Expand All @@ -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)
Expand Down
File renamed without changes
2 changes: 1 addition & 1 deletion sdl2-tutorial.asd
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 8041d52

Please sign in to comment.