;;; -*- mode: lisp; syntax: common-lisp; package: existenz-client; coding: utf-8-unix; -*- (in-package #:existenz-common) (defvar *options* NIL) (defun option (name) (cdr (assoc name *options*))) (defun set-option (name new-value) (setf *options* `((,name . ,new-value) ,@(remove name *options* :test #'eq :key #'car))) new-value) (defsetf option set-option) (defvar *options-mappings* NIL) (defun load-options () (iterate (for (name . variables) in *options-mappings*) (iterate (for value in (option name)) (for variable in variables) (set variable value)))) ;; TODO: make emacs macros for this #| (defmacro defcustom (name value documentation &key (type T))) (defcustom window-resolution (list 640 480) "Width and height of window. Two-element LIST of INTEGERS. Is mapped to the global variables *WINDOW-WIDTH* and *WINDOW-HEIGHT*." :type list) (defcustom window-fullscreen NIL "Whether the application runs in fullscreen or windowed mode. Is mapped to the global variable *WINDOW-FULLSCREEN*." :type boolean) |#