comparison lisp/play/snake.el @ 88155:d7ddb3e565de

sync with trunk
author Henrik Enberg <henrik.enberg@telia.com>
date Mon, 16 Jan 2006 00:03:54 +0000
parents 2b50b378bb16
children
comparison
equal deleted inserted replaced
88154:8ce476d3ba36 88155:d7ddb3e565de
1 ;;; snake.el --- implementation of Snake for Emacs 1 ;;; snake.el --- implementation of Snake for Emacs
2 2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
4 4
5 ;; Author: Glynn Clements <glynn@sensei.co.uk> 5 ;; Author: Glynn Clements <glynn@sensei.co.uk>
6 ;; Created: 1997-09-10 6 ;; Created: 1997-09-10
7 ;; Keywords: games 7 ;; Keywords: games
8 8
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;; GNU General Public License for more details. 19 ;; GNU General Public License for more details.
20 20
21 ;; You should have received a copy of the GNU General Public License 21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING. If not, write to the 22 ;; along with GNU Emacs; see the file COPYING. If not, write to the
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, 23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02111-1307, USA. 24 ;; Boston, MA 02110-1301, USA.
25 25
26 ;;; Commentary: 26 ;;; Commentary:
27 27
28 ;;; Code: 28 ;;; Code:
29 29
368 (use-local-map snake-null-map) 368 (use-local-map snake-null-map)
369 369
370 (setq major-mode 'snake-mode) 370 (setq major-mode 'snake-mode)
371 (setq mode-name "Snake") 371 (setq mode-name "Snake")
372 372
373 (setq mode-popup-menu 373 (unless (featurep 'emacs)
374 '("Snake Commands" 374 (setq mode-popup-menu
375 ["Start new game" snake-start-game] 375 '("Snake Commands"
376 ["End game" snake-end-game 376 ["Start new game" snake-start-game]
377 (snake-active-p)] 377 ["End game" snake-end-game
378 ["Pause" snake-pause-game 378 (snake-active-p)]
379 (and (snake-active-p) (not snake-paused))] 379 ["Pause" snake-pause-game
380 ["Resume" snake-pause-game 380 (and (snake-active-p) (not snake-paused))]
381 (and (snake-active-p) snake-paused)])) 381 ["Resume" snake-pause-game
382 (and (snake-active-p) snake-paused)])))
382 383
383 (setq gamegrid-use-glyphs snake-use-glyphs-flag) 384 (setq gamegrid-use-glyphs snake-use-glyphs-flag)
384 (setq gamegrid-use-color snake-use-color-flag) 385 (setq gamegrid-use-color snake-use-color-flag)
385 386
386 (gamegrid-init (snake-display-options)) 387 (gamegrid-init (snake-display-options))
387 388
388 (run-hooks 'snake-mode-hook)) 389 (run-mode-hooks 'snake-mode-hook))
389 390
390 ;;;###autoload 391 ;;;###autoload
391 (defun snake () 392 (defun snake ()
392 "Play the Snake game. 393 "Play the Snake game.
393 Move the snake around without colliding with its tail or with the border. 394 Move the snake around without colliding with its tail or with the border.
410 (snake-mode) 411 (snake-mode)
411 (snake-start-game)) 412 (snake-start-game))
412 413
413 (provide 'snake) 414 (provide 'snake)
414 415
416 ;;; arch-tag: 512ffc92-cfac-4287-9a4e-92890701a5c8
415 ;;; snake.el ends here 417 ;;; snake.el ends here