unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Oliver Scholz <alkibiades@gmx.de>
Subject: Re: gamegrid.el and some games
Date: Mon, 16 Sep 2002 14:01:20 +0200	[thread overview]
Message-ID: <m37khni507.fsf@ID-87814.user.dfncis.de> (raw)
In-Reply-To: E17qOZG-0000Q8-00@fencepost.gnu.org

[I wrote:]
>     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.

[Correction: I realize now that I used XBM, not PBM in my patch. The
very reason for this is that the Gimp on my machine supports only XBM
so far. However, this should not make a difference for the
discussion.]

Richard Stallman <rms@gnu.org> writes:  
> That is a problem we should fix.  I see two solutions:
>
> * Use a PBM form of the same image.  How hard is that?  Does it have
> drawbacks?

You mean, if a package provides only XPM we should calculate a PBM/XBM
image from that XPM via manipulation of the data strings? I do not
know yet how to do that. I find the problem excitingly interesting,
though. I will look for the specs of the PBM- or XBM format on the
web. But I do not promise anything. I am still working on my "frames
as workspaces"-idea, which I think is more important. And I am very
slow as a programmer.

It is a pity that Emacs does not provide any means to create and
change an image in the image cache directly. This could make this task
(and some others) much easier.

> * Change gamegrid so that it can check for support for a specific
> bitmap type before deciding to use a bitmap of that type.
[...]

I am not sure. Depending on how it is done it could either introduce
incompatibilities to the former version of gamegrid or it could make
gamegrid's interface even less clear.

Gamegrid checks the "environment" (i.e. display capabilities in the
running Emacs) and uses a number of symbols to distinguish some types
of environments. Then the game can setup it's "sprites" for the
different environments using those symbols. The symbol `glyph' stands
for an environment that is able to display images in general.

With my patch the order of "environments" is as follows:

----------
[Emacs is able to display images: 'glyph]

1. use XPM

2. use XBM

[Emacs is able to display colours: 'color-x, 'color-tty]

3. use colored blocks (= spaces with a different background-colour)

[Nothing of the above: 'mono-x, 'mono-tty, 'emacs-tty]

4. use ascii-characters
----------

Now, ignoring the score- and timer-functions for the sake of the
argument, gamegrid has two different scopes:

a) as a library that allows to place a character or image in
   2D-coordinate system, i.e. on a specified column and row.

b) as a library that provides simple tiles for grid-based games.

As I said, I introduced the distinction between XPM and XBM via
`find-image'. This makes perfectly sense for the games that use
gamegrid for b). This affects the games that come with Emacs, which
use only the most simple tiles: pong.el, snake.el and tetris.el. Those
games "want" only coloured squares, their code does not care if those
squares are XPM or PBM. The keyword in gamegrid for this is
`colorize', meaning: "use the standard glyph and change it to colour
XYZ".

But it introduces the problem in question for games that use gamegrid
mainly as a library to place images in a 2D-coordinate-system: this
affects AFAICS only sokoban.el and maybe some future games, not yet
written.

I guess, instead of applying `find-image' we could introduce new
environment types for Emacsen compiled with and without support for
XPM. Then we could fix pong.el, tetris.el and snake.el to be aware of
that distinction. The keyword would then be 'glyph for an Emacs with
support for XPM (for the sake of compatibility) and 'xbm-glyph or
'simple-glyph or whatever for an Emacs that support nothing but the
image types not relying on external libraries.

about jpeg, png or gif? We could justifiedly say that we want to cater
only to sokoban.el (it is IMHO one of the best games available for
Emacs). But then again, we could leave it as it is: sokoban.el
provides a variable to turn off images in general and the user has to
tweak some variables anyways to make sokoban.el work with GNU Emacs.

Hmm, I will look how difficult it is to translate XPM to XBM/PBM,
though ...

    -- Oliver

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

  parent reply	other threads:[~2002-09-16 12:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-13 10:55 gamegrid.el and some games Francesco Potorti`
     [not found] ` <87sn0eglkp.fsf@bundalo.shootybangbang.com>
2002-09-13 13:09   ` Francesco Potorti`
2002-09-14 17:35     ` Richard Stallman
2002-09-13 14:16 ` Oliver Scholz
2002-09-13 17:32   ` Francesco Potorti`
2002-09-13 23:11     ` Oliver Scholz
2002-09-14  1:03       ` Alex Schroeder
2002-09-15  1:50         ` Richard Stallman
2002-09-16 12:11           ` Oliver Scholz
2002-09-19 15:22             ` Luke A. Olbrish
2002-09-20  3:44               ` Richard Stallman
2002-09-15  1:51       ` Richard Stallman
2002-09-16 11:58         ` Oliver Scholz
2002-09-16 19:27           ` Richard Stallman
2002-09-16 12:01         ` Oliver Scholz [this message]
2002-09-16 19:27           ` Richard Stallman
2002-09-16 23:13             ` alkibiades
2002-09-17 15:53               ` Richard Stallman
2002-09-17 16:12                 ` Gerd Moellmann
2002-09-18 15:04                 ` Oliver Scholz
2002-09-18 16:03                   ` Oliver Scholz
2002-09-19 11:45                   ` Eli Zaretskii
2002-09-19 15:17                   ` Richard Stallman
2002-09-20  0:26                     ` Oliver Scholz
2002-09-20  9:40                       ` Miles Bader
2002-09-20 12:01                         ` Oliver Scholz
2002-09-20 10:12                       ` Francesco Potorti`
2002-09-20  1:18                     ` Miles Bader
2002-09-20  9:20                       ` rms
2002-09-20 11:41                         ` Oliver Scholz
2002-09-20  6:54                     ` Gerd Moellmann
2002-09-14 17:35 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m37khni507.fsf@ID-87814.user.dfncis.de \
    --to=alkibiades@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).