minetest-mods / unified_inventory

An extensible inventory mod which allows searching crafting and browsing for recipes in the same dialogue.
Other
50 stars 38 forks source link

Migrate/convert over to formspec version 4 #168

Closed VanessaE closed 3 years ago

VanessaE commented 3 years ago

I recreated the original layout as best as practical, but by necessity there are a few minor positioning changes, since the underlying hard-wired inventory slots are square now and image positioning is now scaled by exactly 1.250 in both dimensions (as opposed to roughly 1.25 by 1.16), and I'd much prefer to keep everything to the same approximate formspec size.

Backstage, I also needed to fix the aspect ratios of the various inventory slot elements. That meant redesigning the single-slot image from scratch. It was already blurry/grainy and a little ugly, and trying to alter it would have only made it worse.

The slot image is now exactly 56x56 pixels square, set on a 64x64 canvas, so there's a 4 pixel empty space around the edges. The full 256px .xcf workfile is included in the UI folder.

I've re-tiled all slot/inv images from the new single slot.

I also re-rendered the trash can icon from it since it was blurry and oddly-sized. I couldn't find the original upstream image, so since they're free, I used one of my Linux system's icons which happens to resemble it.

I also removed a couple more improper uses of background[] where image[] is more appropriate.

There are tons of minor tweaks throughout the code to re-align everything, and I had to rewrite a few sections to avoid code duplication and to allow for a little more flexibility (mainly to make "lite" mode look right).

I also 9-sliced the background image.

Here's how the program looks now: image image image image

And in lite mode:

image image

(the cobble and all those trap doors are just there to show me the alignment of the actual slots relative to the imagery)

SmallJoker commented 3 years ago

What if someone uses larger fonts, either due to bad vision or because they're playing on mobile? The spacing is very tight and risky to conflict with user settings. EDIT: Also barely any language translates All to such a short word. Tous/Alles/Todos would not fit on the button.

VanessaE commented 3 years ago

Well, I have sucky vision and use a larger font already, at size 18 (which you're seeing in these screenshots). Can't imagine someone would need to turn the font size up even more.

The spacing can't really be helped... Since the inventory slots are a little taller in formspec v4 (making them square, which should satisfy your OCD as well as it does mine :smile: ), there's less vertical room to work with, unless I make the whole form a little bigger.

I suppose I could move the crafting grid (and guide) down a little to make more room for the item name, and I can make those buttons bigger.

On mobiles, users are encouraged to use "lite" mode. That's what it's there for.

VanessaE commented 3 years ago

There we go, that should do it.

image

VanessaE commented 3 years ago

Now with 9-sliced inventory slots!

image

Only requires two images to generate all of the inventory slots everywhere in the mod (one regular shade, one bright).

Aside from deleting a lot of redundant images, I got rid of that "ui_misc" image also, since UI doesn't use it at all, and anything that depends on UI and which does need it will already have to be adapted to work with formspec v4, and can most likely just use one of the helpers or variables provided in the new code.

VanessaE commented 3 years ago

9-slicing the slot images made them render very slightly larger and with the corners less round since they aren't blurry anymore. Minor tweaks to the slot images makes it look better:

image