JoeStrout / minimicro-sysdisk

Contents of the /sys disk for the Mini Micro virtual computer
20 stars 11 forks source link

View command, for images, should support zooming in/out with +/~ #20

Open JoeStrout opened 9 months ago

JoeStrout commented 9 months ago

The view command currently draws images at 1:1 size. This can be too big or small to clearly see the image. Add the use of + and - to zoom in and out by a factor of sqrt(2).

In the case of viewing a tileset, don't change the size of the numbers drawn; only change where they are drawn to match the scaled image.

JoeStrout commented 9 months ago

This code is in startup.ms. Your workflow will look like this:

  1. Clone this repo
  2. In Mini Micro, mount the sys folder in slot 1
  3. edit "startup" (or use an external editor)
  4. run it (from the editor, or the run "startup" command)
  5. Test the view command
  6. Goto 3 until done
JoeStrout commented 9 months ago

For a recent example of why this would be useful, see this blog post. It uses this tile set image:

image

But because the tiles are only 8x8 pixels, I couldn't use the view command to usefully display the tile indexes. I had to use a drawing program and manually label all 88 tiles! It was a pain.

With this new feature, we'll be able to view those indexes right within Mini Micro by doing this:

display(5).mode = displayMode.tile
td = display(5)
td.tileSet = file.loadImage("dk_tiles.png")  // or whatever we called the above image
td.tileSetTileSize = 8
view td.tileSet

...and then zooming in until it's legible.