diff options
author | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
---|---|---|
committer | colin <colin@cicadas.surf> | 2024-12-14 08:36:23 -0800 |
commit | 3a2217263d581be9a7f629b10d75aa8e3d581890 (patch) | |
tree | 23f5f0a5449a06473aba2ec7914a3c2193823a10 /src/application.lisp | |
parent | 03cdbb6a15e130a012377ab8d54074b6864e3480 (diff) | |
parent | 8a51ba81c7df6b0b6dab7cf4b35b5ca084b653ba (diff) |
Merge branch 'refactor-with-def'
Diffstat (limited to 'src/application.lisp')
-rw-r--r-- | src/application.lisp | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/application.lisp b/src/application.lisp index 62849c9..f33bb9f 100644 --- a/src/application.lisp +++ b/src/application.lisp @@ -2,38 +2,38 @@ (in-package #:wheelwork) -(defclass/std application (region interactive) - ((title :with :ri :std "Wheelwork App") - (asset-root :ri :std #P"./" :doc "Directory under which assets are stored.") - (asset-classifiers - :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.") - (scale :with :std 1.0 - :doc "Scale factor applied before all - rendering. Affects sizes of all object as well as the - coordinates of mouse events.") - (width height :with :std 800 :doc "Window dimensions in real pixels.") - (projection :with :a :doc "The projection matrix for the scene. Orthographic by default.") - (window :with :a) - (refocus-on-mousedown-p - :std t - :doc "When T, clicking on a visible object will set the - application focus to that object.") - (mouse-button-events-bubble-p - mouse-motion-events-bubble-p - :std nil - :doc "determines whether the search for event handlers stops at - the first visible unit under the xy position of the mouse or - not. ") - (scene focus last-motion-target :with :a) - (fps :std 30 :doc "Frames Per Second") - (frame-wait :r)) - (:documentation "The application contains the information and data - structures necessary for creating a window, adding display units to - it, handling events, and loading resources. You should sublcass - this and write your own BOOT method.")) +(def:class application (region interactive) + (title :prefix :ro :type string :initform "Wheelwork App") + ((asset-root "Directory underwhich assets are stored.") + :ro :type pathname :initform #P"./") + ((asset-classifiers "ALIST of (FILE-EXTENSION CLASS-NAME) pairs.") + :initform '(("png" png) ("ttf" font))) + ((assets "Map of asset names to asset instances") + :prefix :noarg :initform (make-hash-table :test 'equal)) + ((scale "Scale factor applied to all rendering and to all event targeting.") + :prefix :type float :initform 1.0) + ((width "pixel width") + (height "pixel height") + :prefix :type fixnum :initform 800) + ((projection "Scene projection matrix. Orthographic by default.") + :prefix :noarg) + ((window "SDL2 application window.") + :prefix :noarg) + ((refocus-on-mousedown-p "Clicking a visbile unit will set focus to that unit.") + :type boolean :initform t) + (mouse-button-events-bubble-p + mouse-motion-events-bubble-p + :type boolean :initform nil + :documentation "If T, handler search doesn't stop at first visble event target.") + ((scene "Vector of objects to be displayed") + :prefix :noarg :type (vector unit)) + ((focus "Unit with current focus.") + (last-motion-target "Unit that last receved a mouse motion event.") + :prefix :noarg :type (or null unit) :initform nil) + ((fps "Frames per second") + :type fixnum :initform 30) + ((frame-wait "Pause between frames, in seconds") + :type number :ro :noarg)) (defun can-set-projection-p (app) (and (slot-boundp app 'width) |