News:

Want to praise Simutrans?
Your feedback is important for us ;D.

[Tutorial] Get images using gadgets (arrows, X, eye, etc.)

Started by Yona-TYT, May 15, 2025, 12:06:02 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Yona-TYT



I'd like to use images to show some basic actions in the game, such as the X to close windows and the "eye" to follow vehicles, because some GUI themes have different icons, which can be confusing.

In addition to the scenarios, this can also be useful in the help window to explain these aspects.

Yona-TYT

Based on @HaydenRead's old patch, I created a new tag for images with an attribute called "gadget", but I'm having trouble aligning the image with the text.
0001-ADD-Gadgets-images-using-img-tag.patch 


2025-05-27_16-05-1748377995.jpg

Andarix

add in 11720

The graphic is a bit deep and a bit smaller.

Screenshot 2025-06-07 005722.png

Yona-TYT

I've been trying several themes, but I haven't found the optimal alignment.

There is a parameter that adjusts the alignment in gadgets, although I don't know how to apply that same alignment here.


Finally, I am very grateful to @prissi for taking the time to do this. I know you have been very busy these days.  

Best regards. ;)

prissi

I added this together with more images to recall. The string is now
<img src="#?xxx"></img>where ? is either G=general tool icon, S=simple tool icon, D=Dialog tool icon, T=toolbar tool icon, W=windows gadget icon and xx is the number of that tool/gadget, starting at zero.

Yona-TYT

      text["scr"] = "<em>--></em> [text <img src='#g"+ga_gotopos+"'></img>]"

I tried using the variable "ga_gotopos", but the result was a transformer.

2025-06-06_22-06-1749265147.jpg



This is a mistake on my part, duplicate library: https://github.com/simutrans/simutrans/commit/af5b2832cb25ead525fe7d7f0aecbaea5cbbffed#diff-440394758dea6328eed3b175bc28e6a056d673456ed515b644c4fb478542c0b3R12 

prissi


Yona-TYT

Quote from: prissi on June 07, 2025, 03:04:33 AMg is general tool w is a windows gadget
Ahhhh, sorry, I thought the "g" referred to gadgets, hehe.  ;D

Andarix

There's a problem here: not all pack sets will be compatible.

Especially when it comes to tool icons, the graphic definitions may differ. Or older sets may even be missing definitions.

This raises the question of whether the graphics are retrieved via the tool definitions in the menuconf.tab or via the icon pak files.

prissi

The only thing changing are the toolbars icon number. But the toolbars anyway deviate between paksets. Since paksets can have their own toolbar help text since the introduction of this feature, it should be very straightforward to use these icons only for that pak. And tutorials are pakset-specific anyway, so one probably needs to add a toolbar number.

The icons are of course retrieved from the icon definition in the paks. The actual tools can appear more than once with different icons and different default parameter. There is no clear way to retrieve the right one there.

The general, simple and dialog tools may not have a graphic, but then simply nothing will be shown.

Andarix

The background to my question is the use of the img tag in the help.

Screenshot 2025-06-08 081012.png

A conversion file would be another option.

It's essentially a copy of the DAT file, but instead of the image information, the image assignment is in the PAK file. Such a file could also be added to old sets.

prissi

Toolbar help files should go into paksets as they differ a lot between paksets. And in those, the icon images are well defined in the menuconf.tab

Andarix

Quote from: prissi on June 08, 2025, 01:20:41 PMToolbar help files should go into paksets as they differ a lot between paksets. And in those, the icon images are well defined in the menuconf.tab

So you mean that every package should maintain the same tool descriptions. Sorry, but you certainly have the time and inclination to write and maintain these texts for 10 packages.


It is better to save all the tool descriptions individually and then assemble the menu texts using includes.

prissi

The general description will stay as it is now. Paksets can have an extended help file which will overlay the current general one. The differences between toolbars are way too large.