emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: pong.el and color-tty


From: Eli Zaretskii
Subject: Re: pong.el and color-tty
Date: Thu, 31 Jan 2002 08:12:17 +0200 (IST)

On 31 Jan 2002, Kevin Ryde wrote:

> Eli Zaretskii <address@hidden> writes:
> > 
> > AFAICS, pong-blank-color _is_ a string:
> 
> Yes, but it looks like gamegrid.el wants that string value in its zany
> options vector, not the symbol 'pong-blank-color.

That's because AFAICS the color-tty variant was written for XEmacs, not 
for Emacs.  Emacs should use the color-x variant, since in Emacs the Lisp 
API for setting colors and customizing faces is identical for X and 
color-capable tty's (in particular, a color can be "#RRGGBB", as on X).

But I fixed the tty case as well, just in case.  I also limited the game 
grid size to the frame's dimension (which is especially important for a 
tty).

So please try the patches below (they are against the original versions 
of files, without the changes you suggested), and see if the game now 
works on a tty as well.

2002-01-31  Eli Zaretskii  <address@hidden>

        * play/pong.el (pong-height): Don't use height that exceeds the
        frame height.

        * play/gamegrid.el (gamegrid-display-type): Treat any
        color-capable display as color-x, if display-color-p is fboundp.
        (gamegrid-make-color-x-face): Don't call gamegrid-color twice.
        (gamegrid-make-color-tty-face): Use the value of color, not the
        symbol itself.  Don't call gamegrid-color.


Index: lisp/play/gamegrid.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/play/gamegrid.el,v
retrieving revision 1.3
diff -c -r1.3 gamegrid.el
*** lisp/play/gamegrid.el       26 Nov 2001 16:16:45 -0000      1.3
--- lisp/play/gamegrid.el       31 Jan 2002 06:03:19 -0000
***************
*** 166,175 ****
      face))
  
  (defun gamegrid-make-color-tty-face (color)
!   (let* ((hex (gamegrid-color color 1.0))
!        (name (intern (format "gamegrid-color-tty-face-%s" hex)))
         (face (make-face name)))
!     (gamegrid-setup-face face color)
      face))
  
  (defun gamegrid-make-grid-x-face ()
--- 166,175 ----
      face))
  
  (defun gamegrid-make-color-tty-face (color)
!   (let* ((color-str (symbol-value color))
!        (name (intern (format "gamegrid-color-tty-face-%s" color-str)))
         (face (make-face name)))
!     (gamegrid-setup-face face color-str)
      face))
  
  (defun gamegrid-make-grid-x-face ()
***************
*** 190,196 ****
    (let* ((hex (gamegrid-color color 1.0))
         (name (intern (format "gamegrid-color-x-face-%s" hex)))
         (face (make-face name)))
!     (gamegrid-setup-face face (gamegrid-color color 1.0))
      face))
  
  (defun gamegrid-make-face (data-spec-list color-spec-list)
--- 190,196 ----
    (let* ((hex (gamegrid-color color 1.0))
         (name (intern (format "gamegrid-color-x-face-%s" hex)))
         (face (make-face name)))
!     (gamegrid-setup-face face hex)
      face))
  
  (defun gamegrid-make-face (data-spec-list color-spec-list)
***************
*** 257,262 ****
--- 257,264 ----
    (let ((window-system-p 
         (or (and (fboundp 'console-on-window-system-p)
                  (console-on-window-system-p))
+            (and (fboundp 'display-color-p)
+                 (display-color-p))
             window-system)))
    (cond ((and gamegrid-use-glyphs
                window-system-p
Index: lisp/play/pong.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/play/pong.el,v
retrieving revision 1.8
diff -c -r1.8 pong.el
*** lisp/play/pong.el   13 Oct 2001 18:28:55 -0000      1.8
--- lisp/play/pong.el   31 Jan 2002 06:03:38 -0000
***************
*** 49,55 ****
    :group 'pong
    :type '(integer))
  
! (defcustom pong-height 30
    "*Height of the playfield."
    :group 'pong
    :type '(integer))
--- 49,55 ----
    :group 'pong
    :type '(integer))
  
! (defcustom pong-height (min 30 (- (frame-height) 6))
    "*Height of the playfield."
    :group 'pong
    :type '(integer))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]