emacs-devel
[Top][All Lists]
Advanced

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

Re: Making Emacs popular again with a video


From: Corwin Brust
Subject: Re: Making Emacs popular again with a video
Date: Sat, 23 May 2020 04:19:33 -0500

Hello Eli & all, I hope everyone is well in these interesting times.
The rest of this message looks best in org-mode ;)

On Fri, May 15, 2020 at 6:24 AM Eli Zaretskii <address@hidden> wrote:
[...]
>
> We have svg.el for that, can't it be utilized?
>
> > For example text boxes in office apps. I am not sure how easy it is
> > to layout images and have text wrap around it in Emacs and
> > similar.
>
> Shouldn't be a problem, we have image slices since Emacs 21.
>

While hardly a reference implementation, I can put forward some code,
I think to your point.

In the below linked POC we define two formats of org-mode table:

 - Levels, visual layouts intended for display e.g. in image-mode
 - Tiles, abstract draw code used to compose "Levels"

Draw code may simply be a list of SVG XML elements, or a mixed list of
Tile names and SVG path commands, supporting n-depth compositional
reuse.  In either case Coordinates are given in abstract units between
zero and one, eventually scaled as pixels.  Each tile, as given in the
org-table(s) that define it, may contain one or more columns of
draw-code each yielding a layer in the graphic.

When we load the org-tables into hash tables we retain the abstract
units and avoid resolving tile references.  This is because our final
stage of rendering will eventually be on a remote Emacs and also we
may show different versions of the game map to a given persona at any
given moment ("I'm telling ya guys, there's a door there, I see
it!")..  Also, when rendering a given tile, we can conditionally
include or exclude or selecting among alternate sets of draw code for
it.

Repo:
 <http://www.github.com/dungeon-mode/game>

Here's a recipe I often use to test, and which I hope can create an
example image on your system:

1. git clone
2. find init-dm.el, hack hard-coded path within
3. from the directory containing init-dm.el:

  emacs -Q -eval "(progn (find-file "init-dm.el")
(toggle-debug-on-error t) (eval-buffer))"

Finally, and to EOM, a minimal example with both the Level and Tiles
table formats and a code block exposing some internals.

Warm regards,
address@hidden

#+TITLE Test: striping misses overlay for some tiles #7

# Copyright (C) 2020 Corwin Brust, Erik C. Elmshauser, Jon Lincicum,
Hope Christiansen


* Tiles
:PROPERTIES:
:ETL: tile
:END:

This file is a part of dungeon-mode.  It is not a part of GNU Emacs.
This softare is released under the GNU Public Licence version three
or, at your disgression, any newer version of the GNU Public
License.  For specific terms please see [[LICENSE]] at end-of-file.

| tile | overlay          |
| aaa  | <text x=".80" y="1.65" font-size="1">aaa</text> |

| tile | path          |
| aaa  | h3 v3 h-3 v-3 |

| tile | water                 |
| aaa  | m.75,.75 h1.5 v1.5 h-1.5 v-1.5 |


* Cells
:PROPERTIES:
:ETL: cell
:END:

| x | y | path |
| 1 | 1 | aaa  |

* Test

#+BEGIN_SRC emacs-lisp
  (let ((dm-map-files (list (buffer-file-name)))
        (dm-map-draw-other-props '(water))
        (dm-map-background '(nil))
    (dm-map-draw-attributes
     '(path ((fill . "none")
         (stroke . "green")
         (stroke-width . "1"))

       water ((fill . "none")
           (stroke . "orange")
          (stroke-width . "1")))))
    (dm-map-draw t)
    (prin1-to-string (list 'tiles dm-map-tiles 'level dm-map-level)))
#+END_SRC

#+RESULTS:
: (tiles #s(hash-table size 65 test equal rehash-size 1.5
rehash-threshold 0.8125 data (aaa (path ((h (3)) (v (3)) (h (-3)) (v
(-3))) tag nil overlay ((text ((x . 0.8) (y . 1.65) (font-size . 1))
"aaa")) underlay nil stairs nil water ((m (0.75 0.75)) (h (1.5)) (v
(1.5)) (h (-1.5)) (v (-1.5))) beach nil neutronium nil decorations nil
overlay-xml-strings nil))) level #s(hash-table size 65 test equal
rehash-size 1.5 rehash-threshold 0.8125 data ((1 . 1) (path (aaa)))))

* LICENSE

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.



reply via email to

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