(gl:flush)\r
id))\r
\r
-(defun make-quad (id x y w h)\r
- (setf x (- x +screen-width+ ))\r
- (setf y (- y +screen-height+))\r
- (gl:bind-texture :texture-2d id)\r
- (gl:with-primitive :quads\r
- (gl:tex-coord 0 0) (gl:vertex x (+ y h))\r
- (gl:tex-coord 1 0) (gl:vertex (+ x w) (+ y h))\r
- (gl:tex-coord 1 1) (gl:vertex (+ x w) y)\r
- (gl:tex-coord 0 1) (gl:vertex x y)))\r
+(defun load-spritesheet ()\r
+ (let*\r
+ ((id (car (gl:gen-textures 1)))\r
+ (wh (cadr *spritesheet*))\r
+ (pix (car *spritesheet*)))\r
+ (gl:bind-texture :texture-2d id)\r
+ (gl:tex-image-2d :texture-2d 0 :rgba8 wh wh 0 :bgra :unsigned-byte pix)\r
+ (gl:tex-parameter :texture-2d :texture-min-filter :linear)\r
+ (gl:tex-parameter :texture-2d :texture-mag-filter :linear)\r
+ (gl:flush)\r
+ id))\r
+\r
+(defun make-quad (imgs x y w h)\r
+ (destructuring-bind (x1 y1 x2 y2) imgs\r
+ (setf x (- x +screen-width+))\r
+ (setf y (- y +screen-height+))\r
+ (gl:bind-texture :texture-2d *spritesheet-id*)\r
+ (gl:with-primitive :quads\r
+ (gl:tex-coord x1 y1) (gl:vertex x (+ y h))\r
+ (gl:tex-coord x2 y1) (gl:vertex (+ x w) (+ y h))\r
+ (gl:tex-coord x2 y2) (gl:vertex (+ x w) y)\r
+ (gl:tex-coord x1 y2) (gl:vertex x y))))\r
\r