;;; -*- lexical-binding: t -*- ;; ;; -------------------------------------------------------------------------- (require 'cl-lib) (cl-pushnew "." load-path :test #'string=) (require 'luki-lisp) ;; -------------------------------------------------------------------------- (-> 'bad-elem) (-> 'bad-font) (-> 'bad-mode) ;; -------------------------------------------------------------------------- (defclass program (elem) ((name :initform "bad/draw game") (buf :initarg :buf :type buffer :initform (get-buffer-create "*bad-buffer*")) (bgr :initarg :bg :type (or null ascii) :intiform nil) (field :initarg :field :type (or null borderless) :initform nil) (tmr :initarg :tmr :type (or null vector) :initform nil))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-set-field ((p program) &optional w h) (or w (setq w (frame-width))) (or h (setq h (frame-height))) (~ ((wg w) (hg h)) p (setf wg w) (setf hg h))) (cl-defmethod bad-next-font ((p program) &optional prev) (when (gfx) (bad-next-monospace-font prev) (bad-set-field p))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-setup ((p program)) (~ (buf) p (with-current-buffer buf (bad-mode) (bad-prepare) (bad-next-font p) (pop-to-buffer buf) (delete-other-windows)))) ;; -------------------------------------------------------------------------- (cl-defmethod bad-quit ((p program)) (~ (tmr) p (when (& tmr (timerp tmr)) (cancel-timer tmr)) (kill-emacs))) ;; -------------------------------------------------------------------------- (<- 'bad-program)