]> git.eshelyaron.com Git - emacs.git/commitdiff
(pong-border-options): Use color on tty if
authorFrancesco Potortì <pot@gnu.org>
Fri, 13 Sep 2002 13:28:12 +0000 (13:28 +0000)
committerFrancesco Potortì <pot@gnu.org>
Fri, 13 Sep 2002 13:28:12 +0000 (13:28 +0000)
available.  Reset color on tty to be [0.5 0.5 0.5].

lisp/play/pong.el

index cc96e72375b469a710383577f65e1549e907427c..d23701ac439a019728155e546e700a9aa98c3c84 100644 (file)
 
 ;;; 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)
 
   '(((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)))