Created
February 21, 2020 20:06
-
-
Save PuercoPop/602c1fb39204d181aec7e413bdb5bdb5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defclass entity () | |
() | |
(:documentation "Used to track all entities")) | |
(defmacro defentity (name parents &body (attributes)) | |
`(defclass ,name ,(append parents (list 'entity)) ,attributes)) | |
(defentity wall (drawable) | |
((color :initform (rgb 255 255 255)) | |
(char :initform #\#))) | |
;; I need/want to generate a texture for each char before entering the main loop | |
;; So something like this | |
(defun generate-drawable-texture (drawable) | |
(let* ((color-slot-def (find-slot drawable-class 'color)) | |
(color (funcall (slot-definition-initfunction color-slot-def))) | |
(surface (sdl2-ttf:render-text-solid +font+ | |
(string (drawable-char drawable)) | |
(red (drawable-color drawable)) | |
(green (drawable-color drawable)) | |
(blue (drawable-color drawable)) | |
(alpha (drawable-color drawable)))) | |
(texture (create-texture-from-surface *renderer* | |
surface))) | |
(free-surface surface) | |
texture)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment