diff options
author | Francesco Potortì <pot@gnu.org> | 2002-09-13 13:28:12 +0000 |
---|---|---|
committer | Francesco Potortì <pot@gnu.org> | 2002-09-13 13:28:12 +0000 |
commit | 309adc007aa5b3e557bad6348a722890ac23400a (patch) | |
tree | c7b49b60ad5d6f97d4357fb4d6d6ac9c1d171973 | |
parent | 1204d0e7bcf45ece7f5639d8220d91c1cc74d6ca (diff) | |
download | emacs-309adc007aa5b3e557bad6348a722890ac23400a.tar.gz |
(pong-border-options): Use color on tty if
available. Reset color on tty to be [0.5 0.5 0.5].
-rw-r--r-- | lisp/play/pong.el | 43 |
1 files changed, 20 insertions, 23 deletions
diff --git a/lisp/play/pong.el b/lisp/play/pong.el index cc96e72375b..d23701ac439 100644 --- a/lisp/play/pong.el +++ b/lisp/play/pong.el @@ -34,12 +34,12 @@ ;;; Customization -(defgroup pong nil +(defgroup pong nil "Emacs-Lisp implementation of the classical game pong." :tag "Pong" :group 'games) -(defcustom pong-buffer-name "*Pong*" +(defcustom pong-buffer-name "*Pong*" "*Name of the buffer used to play." :group 'pong :type '(string)) @@ -75,7 +75,7 @@ :type 'color) (defcustom pong-border-color "white" - "*Color used for pong balls." + "*Color used for pong borders." :group 'pong :type 'color) @@ -155,12 +155,9 @@ '(((glyph colorize) (t ?\+)) ((color-x color-x) - (mono-x grid-x)) - ;; The colors used to be [0.5 0.5 0.5], but that produces a black - ;; color on 8-color tty's, which would make the border invisible. - ;; 0.51 produces white on such tty's, and at the same time has - ;; almost no effect on X and similar displays. - (((glyph color-x) [0.51 0.51 0.51]) + (mono-x grid-x) + (color-tty color-tty)) + (((glyph color-x) [0.5 0.5 0.5]) (color-tty pong-border-color)))) (defconst pong-blank 0) @@ -316,12 +313,12 @@ implementations you move with left/right paddle." (gamegrid-set-cell x (1- y) pong-blank)) (if (< (+ y pong-bat-width) (1- pong-height)) (gamegrid-set-cell x (+ y pong-bat-width) pong-blank))))) - + (defun pong-init () "Initialize a game." - + (define-key pong-mode-map pong-pause-key 'pong-pause) (make-local-hook 'kill-buffer-hook) @@ -349,44 +346,44 @@ updates ball and bats positions. It is responsible of collision detection and checks if a player scores." (if (not (eq (current-buffer) pong-buffer)) (pong-pause) - + (let ((old-x pong-x) (old-y pong-y)) - + (setq pong-x (+ pong-x pong-xx)) (setq pong-y (+ pong-y pong-yy)) - + (if (and (> old-y 0) (< old-y (- pong-height 1))) (gamegrid-set-cell old-x old-y pong-blank)) - + (if (and (> pong-y 0) (< pong-y (- pong-height 1))) (gamegrid-set-cell pong-x pong-y pong-ball)) - + (cond ((or (= pong-x 3) (= pong-x 2)) - (if (and (>= pong-y pong-bat-player1) + (if (and (>= pong-y pong-bat-player1) (< pong-y (+ pong-bat-player1 pong-bat-width))) - (and + (and (setq pong-yy (+ pong-yy - (cond + (cond ((= pong-y pong-bat-player1) -1) ((= pong-y (1+ pong-bat-player1)) 0) (t 1)))) (setq pong-xx (- pong-xx))))) ((or (= pong-x (- pong-width 4)) (= pong-x (- pong-width 3))) - (if (and (>= pong-y pong-bat-player2) + (if (and (>= pong-y pong-bat-player2) (< pong-y (+ pong-bat-player2 pong-bat-width))) - (and + (and (setq pong-yy (+ pong-yy - (cond + (cond ((= pong-y pong-bat-player2) -1) ((= pong-y (1+ pong-bat-player2)) 0) (t 1)))) (setq pong-xx (- pong-xx))))) - + ((<= pong-y 1) (setq pong-yy (- pong-yy))) |