Great! Thanks Hans, now it works. I replaced the "draw externalfigure"
commands by
draw externalfigure "./skysprite.png" xsized 4u ysized 5u shifted (0u,-0u);
draw externalfigure "./sandsprite.png" xsized 4u ysized 5u shifted (0u,-5u);
Best regards
On Sun, Jan 2, 2022 at 3:36 PM Hans Hagen
I'm trying to use ConTeXt with Metafun to produce a map of a videogame I am working on. In fact I did it 9 years ago but it seems that now it doesn't work.
I have two 32 pixels wide by 40 pixels high sprites. They are saved in the skysprite.png and sandsprite.png files. Since 32 = 4 x 8 and 40 = 5 x 8, the width/height ratio is 4/5.
This should produce a page with a sky sprite and a sand sprite, one below the other. It worked in the past. Each sprite should be 4 x 0.095 cm = 0,38 cm wide and 5 x 0.095 cm = 0.475 cm high:
\starttext \setupMPinstance[metafun][textstyle={\switchtobodyfont[termes,8pt]}] \startuseMPgraphic{mapa} u:=.095cm; draw externalfigure "./skysprite.png" xscaled 4u yscaled 5u shifted (0u,-0u); draw externalfigure "./sandsprite.png" xscaled 4u yscaled 5u shifted (0u,-5u); \stopuseMPgraphic \useMPgraphic{mapa} \stoptext
But instead I got two huge sprites of 2.8 cm x 4.4 cm.
Am I forgetting something? Originally that worked because the image was always 'included' at 1 bp and then scaled but that was (1) inaccurate and (2) a bit depending on
On 1/2/2022 3:12 PM, Alfredo Catalina via ntg-context wrote: the image and (3) could overflow metapost.
Use xsized and ysized instead (absolute measures instead of scaling the unknown)
Hans
----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------