diff options
author | Andrea Corallo <akrl@sdf.org> | 2021-02-21 22:08:01 +0100 |
---|---|---|
committer | Andrea Corallo <akrl@sdf.org> | 2021-02-21 22:08:01 +0100 |
commit | cf1e8e792f60949e09e3ad4c53fb61b0b7628229 (patch) | |
tree | 35080229c9e3b46e5db14a2f051c001ab8c6e586 /lisp/play | |
parent | 39792cf62987ecc1a772f6a2027d6b32c70e8312 (diff) | |
parent | d0c47652e527397cae96444c881bf60455c763c1 (diff) | |
download | emacs-cf1e8e792f60949e09e3ad4c53fb61b0b7628229.tar.gz emacs-cf1e8e792f60949e09e3ad4c53fb61b0b7628229.tar.bz2 emacs-cf1e8e792f60949e09e3ad4c53fb61b0b7628229.zip |
Merge remote-tracking branch 'savannah/master' into HEAD
Diffstat (limited to 'lisp/play')
-rw-r--r-- | lisp/play/bubbles.el | 130 | ||||
-rw-r--r-- | lisp/play/handwrite.el | 2 | ||||
-rw-r--r-- | lisp/play/snake.el | 15 | ||||
-rw-r--r-- | lisp/play/tetris.el | 19 |
4 files changed, 72 insertions, 94 deletions
diff --git a/lisp/play/bubbles.el b/lisp/play/bubbles.el index dc93ef90310..dddd19fa0a3 100644 --- a/lisp/play/bubbles.el +++ b/lisp/play/bubbles.el @@ -811,78 +811,7 @@ static char * dot3d_xpm[] = { (bubbles--initialize-images) (bubbles--update-faces-or-images)) -;; game theme menu -(defvar bubbles-game-theme-menu - (let ((menu (make-sparse-keymap "Game Theme"))) - (define-key menu [bubbles-set-game-userdefined] - (list 'menu-item "User defined" 'bubbles-set-game-userdefined - :button '(:radio . (eq bubbles-game-theme 'user-defined)))) - (define-key menu [bubbles-set-game-hard] - (list 'menu-item "Hard" 'bubbles-set-game-hard - :button '(:radio . (eq bubbles-game-theme 'hard)))) - (define-key menu [bubbles-set-game-difficult] - (list 'menu-item "Difficult" 'bubbles-set-game-difficult - :button '(:radio . (eq bubbles-game-theme 'difficult)))) - (define-key menu [bubbles-set-game-medium] - (list 'menu-item "Medium" 'bubbles-set-game-medium - :button '(:radio . (eq bubbles-game-theme 'medium)))) - (define-key menu [bubbles-set-game-easy] - (list 'menu-item "Easy" 'bubbles-set-game-easy - :button '(:radio . (eq bubbles-game-theme 'easy)))) - menu) - "Map for bubbles game theme menu.") - -;; graphics theme menu -(defvar bubbles-graphics-theme-menu - (let ((menu (make-sparse-keymap "Graphics Theme"))) - (define-key menu [bubbles-set-graphics-theme-ascii] - (list 'menu-item "ASCII" 'bubbles-set-graphics-theme-ascii - :button '(:radio . (eq bubbles-graphics-theme 'ascii)))) - (define-key menu [bubbles-set-graphics-theme-emacs] - (list 'menu-item "Emacs" 'bubbles-set-graphics-theme-emacs - :button '(:radio . (eq bubbles-graphics-theme 'emacs)))) - (define-key menu [bubbles-set-graphics-theme-balls] - (list 'menu-item "Balls" 'bubbles-set-graphics-theme-balls - :button '(:radio . (eq bubbles-graphics-theme 'balls)))) - (define-key menu [bubbles-set-graphics-theme-diamonds] - (list 'menu-item "Diamonds" 'bubbles-set-graphics-theme-diamonds - :button '(:radio . (eq bubbles-graphics-theme 'diamonds)))) - (define-key menu [bubbles-set-graphics-theme-squares] - (list 'menu-item "Squares" 'bubbles-set-graphics-theme-squares - :button '(:radio . (eq bubbles-graphics-theme 'squares)))) - (define-key menu [bubbles-set-graphics-theme-circles] - (list 'menu-item "Circles" 'bubbles-set-graphics-theme-circles - :button '(:radio . (eq bubbles-graphics-theme 'circles)))) - menu) - "Map for bubbles graphics theme menu.") - -;; menu -(defvar bubbles-menu - (let ((menu (make-sparse-keymap "Bubbles"))) - (define-key menu [bubbles-quit] - (list 'menu-item "Quit" 'bubbles-quit)) - (define-key menu [bubbles] - (list 'menu-item "New game" 'bubbles)) - (define-key menu [bubbles-separator-1] - '("--")) - (define-key menu [bubbles-save-settings] - (list 'menu-item "Save all settings" 'bubbles-save-settings)) - (define-key menu [bubbles-customize] - (list 'menu-item "Edit all settings" 'bubbles-customize)) - (define-key menu [bubbles-game-theme-menu] - (list 'menu-item "Game Theme" bubbles-game-theme-menu)) - (define-key menu [bubbles-graphics-theme-menu] - (list 'menu-item "Graphics Theme" bubbles-graphics-theme-menu - :enable 'bubbles--playing)) - (define-key menu [bubbles-separator-2] - '("--")) - (define-key menu [bubbles-undo] - (list 'menu-item "Undo last move" 'bubbles-undo - :enable '(and bubbles--playing (listp buffer-undo-list)))) - menu) - "Map for bubbles menu.") - -;; bubbles mode map + (defvar bubbles-mode-map (let ((map (make-sparse-keymap 'bubbles-mode-map))) ;; (suppress-keymap map t) @@ -897,12 +826,59 @@ static char * dot3d_xpm[] = { (define-key map "n" 'next-line) (define-key map "f" 'forward-char) (define-key map "b" 'backward-char) - ;; bind menu to mouse - (define-key map [down-mouse-3] bubbles-menu) - ;; Put menu in menu-bar - (define-key map [menu-bar Bubbles] (cons "Bubbles" bubbles-menu)) map) - "Mode map for bubbles.") + "Mode map for `bubbles'.") + +(easy-menu-define bubbles-menu bubbles-mode-map + "Menu for `bubbles'." + '("Bubbles" + ["Undo last move" bubbles-undo + :enable '(and bubbles--playing (listp buffer-undo-list))] + "---" + ("Graphics Theme" + :enable bubbles--playing + ["Circles" bubbles-set-graphics-theme-circles + :style radio + :selected (eq bubbles-graphics-theme 'circles)] + ["Squares" bubbles-set-graphics-theme-squares + :style radio + :selected (eq bubbles-graphics-theme 'squares)] + ["Diamonds" bubbles-set-graphics-theme-diamonds + :style radio + :selected (eq bubbles-graphics-theme 'diamonds)] + ["Balls" bubbles-set-graphics-theme-balls + :style radio + :selected (eq bubbles-graphics-theme 'balls)] + ["Emacs" bubbles-set-graphics-theme-emacs + :style radio + :selected (eq bubbles-graphics-theme 'emacs)] + ["ASCII" bubbles-set-graphics-theme-ascii + :style radio + :selected (eq bubbles-graphics-theme 'ascii)]) + ("Game Theme" + ["Easy" bubbles-set-game-easy + :style radio + :selected (eq bubbles-game-theme 'easy)] + ["Medium" bubbles-set-game-medium + :style radio + :selected (eq bubbles-game-theme 'medium)] + ["Difficult" bubbles-set-game-difficult + :style radio + :selected (eq bubbles-game-theme 'difficult)] + ["Hard" bubbles-set-game-hard + :style radio + :selected (eq bubbles-game-theme 'hard)] + ["User defined" bubbles-set-game-userdefined + :style radio + :selected (eq bubbles-game-theme 'user-defined)]) + ["Edit all settings" bubbles-customize] + ["Save all settings" bubbles-save-settings] + "---" + ["New game" bubbles] + ["Quit" bubbles-quit])) + +;; bind menu to mouse +(define-key bubbles-mode-map [down-mouse-3] bubbles-menu) (define-derived-mode bubbles-mode nil "Bubbles" "Major mode for playing bubbles. diff --git a/lisp/play/handwrite.el b/lisp/play/handwrite.el index 98da26c2e6c..3cc5d9c8dce 100644 --- a/lisp/play/handwrite.el +++ b/lisp/play/handwrite.el @@ -90,7 +90,7 @@ (define-key map [handwrite] '("Write by hand" . handwrite)) map)) (fset 'menu-bar-handwrite-map menu-bar-handwrite-map) - +(make-obsolete-variable 'menu-bar-handwrite-map nil "28.1") ;; User definable variables diff --git a/lisp/play/snake.el b/lisp/play/snake.el index bed7cea6ee5..29effa23460 100644 --- a/lisp/play/snake.el +++ b/lisp/play/snake.el @@ -336,38 +336,38 @@ Argument SNAKE-BUFFER is the name of the buffer." (defun snake-move-left () "Make the snake move left." - (interactive) + (interactive nil snake-mode) (when (zerop (snake-final-x-velocity)) (push '(-1 0) snake-velocity-queue))) (defun snake-move-right () "Make the snake move right." - (interactive) + (interactive nil snake-mode) (when (zerop (snake-final-x-velocity)) (push '(1 0) snake-velocity-queue))) (defun snake-move-up () "Make the snake move up." - (interactive) + (interactive nil snake-mode) (when (zerop (snake-final-y-velocity)) (push '(0 -1) snake-velocity-queue))) (defun snake-move-down () "Make the snake move down." - (interactive) + (interactive nil snake-mode) (when (zerop (snake-final-y-velocity)) (push '(0 1) snake-velocity-queue))) (defun snake-end-game () "Terminate the current game." - (interactive) + (interactive nil snake-mode) (gamegrid-kill-timer) (use-local-map snake-null-map) (gamegrid-add-score snake-score-file snake-score)) (defun snake-start-game () "Start a new game of Snake." - (interactive) + (interactive nil snake-mode) (snake-reset-game) (snake-set-dot) (use-local-map snake-mode-map) @@ -375,7 +375,7 @@ Argument SNAKE-BUFFER is the name of the buffer." (defun snake-pause-game () "Pause (or resume) the current game." - (interactive) + (interactive nil snake-mode) (setq snake-paused (not snake-paused)) (message (and snake-paused "Game paused (press p to resume)"))) @@ -386,6 +386,7 @@ Argument SNAKE-BUFFER is the name of the buffer." (define-derived-mode snake-mode special-mode "Snake" "A mode for playing Snake." + :interactive nil (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index 05e4ffe0111..f43aa47326f 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el @@ -506,7 +506,7 @@ Drops the shape one square, testing for collision." (defun tetris-move-bottom () "Drop the shape to the bottom of the playing area." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (let ((hit nil)) (tetris-erase-shape) @@ -519,7 +519,7 @@ Drops the shape one square, testing for collision." (defun tetris-move-left () "Move the shape one square to the left." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (tetris-erase-shape) (setq tetris-pos-x (1- tetris-pos-x)) @@ -529,7 +529,7 @@ Drops the shape one square, testing for collision." (defun tetris-move-right () "Move the shape one square to the right." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (tetris-erase-shape) (setq tetris-pos-x (1+ tetris-pos-x)) @@ -539,7 +539,7 @@ Drops the shape one square, testing for collision." (defun tetris-move-down () "Move the shape one square to the bottom." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (tetris-erase-shape) (setq tetris-pos-y (1+ tetris-pos-y)) @@ -549,7 +549,7 @@ Drops the shape one square, testing for collision." (defun tetris-rotate-prev () "Rotate the shape clockwise." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (tetris-erase-shape) (setq tetris-rot (% (+ 1 tetris-rot) @@ -561,7 +561,7 @@ Drops the shape one square, testing for collision." (defun tetris-rotate-next () "Rotate the shape anticlockwise." - (interactive) + (interactive nil tetris-mode) (unless tetris-paused (tetris-erase-shape) (setq tetris-rot (% (+ 3 tetris-rot) @@ -573,14 +573,14 @@ Drops the shape one square, testing for collision." (defun tetris-end-game () "Terminate the current game." - (interactive) + (interactive nil tetris-mode) (gamegrid-kill-timer) (use-local-map tetris-null-map) (gamegrid-add-score tetris-score-file tetris-score)) (defun tetris-start-game () "Start a new game of Tetris." - (interactive) + (interactive nil tetris-mode) (tetris-reset-game) (use-local-map tetris-mode-map) (let ((period (or (tetris-get-tick-period) @@ -589,7 +589,7 @@ Drops the shape one square, testing for collision." (defun tetris-pause-game () "Pause (or resume) the current game." - (interactive) + (interactive nil tetris-mode) (setq tetris-paused (not tetris-paused)) (message (and tetris-paused "Game paused (press p to resume)"))) @@ -600,6 +600,7 @@ Drops the shape one square, testing for collision." (define-derived-mode tetris-mode nil "Tetris" "A mode for playing Tetris." + :interactive nil (add-hook 'kill-buffer-hook 'gamegrid-kill-timer nil t) |