emacs-devel
[Top][All Lists]
Advanced

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

Re: gamegrid.el and some games


From: Oliver Scholz
Subject: Re: gamegrid.el and some games
Date: Sat, 14 Sep 2002 01:11:31 +0200
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i686-pc-linux-gnu)

Francesco Potorti` <address@hidden> writes:

[...]
>    I have send a patch some time ago, which enables XPM (and PBM) for
>    gamegrid. (BTW what happend to this patch?) 
>
> Would you send it to me?  

O.K. Attached. The diff is against the version of gamegrid.el that
comes with Emacs 21.2. AFAICS there are some changes in the current
CVS. Could this cause problems? I am not familiar with diff & patch.

> I was just trying to do that.

*hehehe* I was quicker.
    
>    I guess gamegrid is mainly supposed to provide simple grids,
>    i.e. colored squares. 
>
> Yes, after some study I arrived to the same conclusion, so I further
> reduced my patch to pong.el, tetris.el, snake.el before installing it.
>
>                          The option to use characters is -- I guess --
>    intended only as a fallback on ttys without color. OTOH: it allows to
>    utilize arbitrary XPM images 
>
> Yes, for example pong could use a real ball.

Oh, that's easy:

(defvar pong-ball-glyph
"/* XPM */
static char * ball_xpm[] = {
\"16 16 4 1\",
\"      c Black\",
\"+     c Red4\",
\"-     c Red1\",
\".     c Red\",
\"     ------     \",
\"   ----------   \",
\"  ----....--++  \",
\" ---........+++ \",
\" --..........++ \",
\"---..........+++\",
\"--............++\",
\"--............++\",
\"--............++\",
\"--............++\",
\"---..........+++\",
\" --..........++ \",
\" ---........+++ \",
\"  -+++....++++  \",
\"   ++++++++++   \",
\"     ++++++     \"};")

(defvar pong-ball-options
  `(((glyph [xpm :data ,pong-ball-glyph])
     (t ?\*))
    ((color-x color-x)
     (mono-x grid-x)
     (color-tty color-tty))
    (((glyph color-x) [1 0 0])
     (color-tty pong-ball-color))))

This reveals, however, a problem with my patch:

As I said, I use `display-images-p' and then `find-image' to get
either XPM or PBM; the latter AFAIU is supposed to be always available
if `display-images-p' returns t.

This is o.k. for all games that come with Emacs. But it could lead to
unexpected results for packages like sokoban.el or for pong if you add
the image above: if an Emacs is compiled without support for XPM,
there is no PBM as a fall-back.

    -- Oliver

Attachment: gamegrid.diff
Description: Text Data

-- 
28 Fructidor an 210 de la Révolution
Liberté, Egalité, Fraternité!

reply via email to

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