Skip to content

Commit

Permalink
Refactor tutorial 15
Browse files Browse the repository at this point in the history
  • Loading branch information
Yan committed Jan 8, 2022
1 parent 2bf5b6c commit cfec61d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions 15/tutorial-15.lisp → 15-rotation-and-flipping.lisp
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
(defpackage #:sdl2-tutorial-15
(:use :common-lisp)
(:export :main))
(defpackage #:sdl2-tutorial-15-rotation-and-flipping
(:use :cl)
(:export :run)
(:import-from :sdl2-tutorial-utils :asset-pathname))

(in-package :sdl2-tutorial-15)
(in-package #:sdl2-tutorial-15-rotation-and-flipping)

(defparameter *screen-width* 640)
(defparameter *screen-height* 480)
Expand Down Expand Up @@ -51,17 +52,17 @@
(defmacro with-window-renderer ((window renderer) &body body)
`(sdl2:with-init (:video)
(sdl2:with-window (,window
:title "SDL2 Tutorial"
:title "SDL2 Tutorial 15"
:w *screen-width*
:h *screen-height*
:flags '(:shown))
(sdl2:with-renderer (,renderer ,window :index -1 :flags '(:accelerated))
,@body))))

(defun main()
(defun run ()
(with-window-renderer (window renderer)
(sdl2-image:init '(:png))
(let ((texture (load-texture-from-file renderer "15/arrow.png"))
(let ((texture (load-texture-from-file renderer (asset-pathname "assets/15/arrow.png")))
(flip :none)
(degrees 0)
(delta 60))
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 @@ -19,7 +19,7 @@
(:file "12-color-modulation")
(:file "13-alpha-blending")
(:file "14-animated-sprites-and-vsync")
(:file "15/tutorial-15")
(:file "15-rotation-and-flipping")
(:file "16/tutorial-16"))
:in-order-to ((test-op (test-op "sdl2-tutorial/tests"))))

Expand Down

0 comments on commit cfec61d

Please sign in to comment.