aboutsummaryrefslogtreecommitdiffhomepage
path: root/wheelwork.lisp
diff options
context:
space:
mode:
authorColin Okay <colin@cicadas.surf>2022-06-25 08:06:22 -0500
committerColin Okay <colin@cicadas.surf>2022-06-25 08:06:22 -0500
commit05ee2bdfd476271d3df1bb8c6aea4abbd09f4d30 (patch)
treef2f4238e06e5f4c51dcc0a63d19c459eb38bdb85 /wheelwork.lisp
parent0710c2fd30745c7b1e26e9934383d997f298c3fb (diff)
[modify] texture no longer an asset; [add] png class
Diffstat (limited to 'wheelwork.lisp')
-rw-r--r--wheelwork.lisp22
1 files changed, 11 insertions, 11 deletions
diff --git a/wheelwork.lisp b/wheelwork.lisp
index 52f0eb0..2e23c96 100644
--- a/wheelwork.lisp
+++ b/wheelwork.lisp
@@ -151,7 +151,7 @@ necessary."
((title :with :std "Wheelwork App")
(asset-root :ri :std #P"./" :doc "Directory under which assets are stored.")
(asset-classifiers
- :std '(("png" texture))
+ :std '(("png" png) ("ttf" font))
:doc "ALIST of (EXT CLASS). EXT is a string, file estension. CLASS is a symbol, class name.")
(assets :with :a :std (make-hash-table :test 'equal)
:doc "maps asset names to asset instances.")
@@ -333,7 +333,7 @@ necessary."
(setf (asset-loadedp thing) t))
thing)
-(defclass/std texture (asset)
+(defclass/std texture ()
((width height id mipmap :with :r)
(internal-format image-format :ri :with :std :rgba)
(wrap-s wrap-t :ri :with :std :repeat)
@@ -342,13 +342,15 @@ necessary."
(defmethod cleanup ((texture texture))
(gl:delete-texture (texture-id texture)))
-(defmethod ensure-loaded ((texture texture))
+(defclass/std png (asset texture) ())
+
+(defmethod ensure-loaded ((png png))
(with-slots
(width height id wrap-s wrap-t min-filter mag-filter internal-format image-format)
- texture
- (pngload:with-png-in-static-vector (png (asset-path texture) :flip-y t)
- (setf width (pngload:width png)
- height (pngload:height png)
+ png
+ (pngload:with-png-in-static-vector (data (asset-path png) :flip-y t)
+ (setf width (pngload:width data)
+ height (pngload:height data)
id (gl:gen-texture))
(gl:bind-texture :texture-2d id)
(gl:tex-parameter :texture-2d :texture-wrap-s wrap-s)
@@ -363,14 +365,12 @@ necessary."
0
image-format
:unsigned-byte
- (pngload:data png))
+ (pngload:data data))
(gl:bind-texture :texture-2d 0)
- (when (texture-mipmap texture)
+ (when (texture-mipmap png)
(gl:generate-mipmap :texture-2d)))))
-
-
(defun refocus-on (target &optional (app *application*))
"Sets focus of application to TARGET, if TARGET is focusable. "
(when (focusablep target)