I know it's possible to texture formspec menus, by defining a background image for each. I was however wondering if there's also a way to define a default appearance for all formspecs, including background texture and perhaps text color. If not, could this ability be added in some form?
I seek this because I wish to texture the menus for minetest_game. However, I'm not going to re-define every individual formspec... such as inventory, chests, furnace, pause menu, etc. Even if I did that, mods which add their own formspec windows (like workbenches, technic_game engines, or things that rely on the Inventory+ buttons) would also have to be edited to use the same appearance. You also can't texture the main menu this way, or at least not easily... whereas a default per-game formspec theme would help a lot.
Obviously, when a formspec defines its own appearance, that should be used instead. I'm only looking to specify game defaults so the black transparent background and gray inventory boxes are replaced with something else.
Default formspec appearance
- MirceaKitsune
- Member
- Posts: 867
- Joined: Sat May 21, 2011 22:31
- GitHub: MirceaKitsune
- IRC: Taoki
- In-game: MirceaKitsune
- Location: Romania, Bucharest
- Contact:
Re: Default formspec appearance
Since minetest_game is frozen don't expect a change like that. Use minetest_next for that, which is a maintained minetest_game. It already has textured formspecs...
Last edited by BlockMen on Sun Jun 15, 2014 17:08, edited 1 time in total.
- rubenwardy
- Moderator
- Posts: 6374
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: United Kingdom
- Contact:
Re: Default formspec appearance
You wouldn't need to modify minetest_game. You could do it in builtin. (Add the possibility to change default formspec appearance.)
Or even in a mod. You could override minetest.show_formspec and check for background[] etc.
Or even in a mod. You could override minetest.show_formspec and check for background[] etc.
Core Developer | Donate | My Twitter | Mods | Mods 4 Android | Minetest Modding Book
Hello profile reader
Hello profile reader
Re: Default formspec appearance
minetest.show_formspec() is not in builtin, its in the engine itself. So you can't override it that way. And i dont like that idea at all...rubenwardy wrote:You wouldn't need to modify minetest_game. You could do it in builtin. (Add the possibility to change default formspec appearance.)
Or even in a mod. You could override minetest.show_formspec and check for background[] etc.
- rubenwardy
- Moderator
- Posts: 6374
- Joined: Tue Jun 12, 2012 18:11
- GitHub: rubenwardy
- IRC: rubenwardy
- In-game: rubenwardy
- Location: United Kingdom
- Contact:
Re: Default formspec appearance
BlockMen wrote:minetest.show_formspec() is not in builtin, its in the engine itself. So you can't override it that way. And i dont like that idea at all...rubenwardy wrote:You wouldn't need to modify minetest_game. You could do it in builtin. (Add the possibility to change default formspec appearance.)
Or even in a mod. You could override minetest.show_formspec and check for background[] etc.
You can still override it.
Code: Select all
local _tmp = minetest.show_formspec
function minetest.show_formspec(name, form, spec)
-- Check for background, background image, etc
-- If not found, do this:
spec = "background[askdn]" .. spec
_tmp(name, form, spec)
end
Core Developer | Donate | My Twitter | Mods | Mods 4 Android | Minetest Modding Book
Hello profile reader
Hello profile reader
- MirceaKitsune
- Member
- Posts: 867
- Joined: Sat May 21, 2011 22:31
- GitHub: MirceaKitsune
- IRC: Taoki
- In-game: MirceaKitsune
- Location: Romania, Bucharest
- Contact:
Re: Default formspec appearance
Awesome, that's what I was looking for! Since the additional "background" line goes at the beginning of the formspec string, it should also not break formspecs that use their own background image as it's listed later. Thanks!rubenwardy wrote:You can still override it.
A mod would be best. You could do it in builtin.Code: Select all
local _tmp = minetest.show_formspec function minetest.show_formspec(name, form, spec) -- Check for background, background image, etc -- If not found, do this: spec = "background[askdn]" .. spec _tmp(name, form, spec) end
One more question: Can I do it in a way that also overrides the main menu once the game is selected? That sounds a little trickier, since the script must execute before you start the server but also have an effect in-game.
I agree with adding a hook like this to builtin, to make this ability easier for everyone.
- twoelk
- Member
- Posts: 1411
- Joined: Fri Apr 19, 2013 16:19
- GitHub: twoelk
- IRC: twoelk
- In-game: twoelk
- Location: northern Germany
Re: Default formspec appearance
yay - why out there on the horizon, slowly approaching, an easily skinable GUI detected. Hopefully not a fatamorgana.
- MirceaKitsune
- Member
- Posts: 867
- Joined: Sat May 21, 2011 22:31
- GitHub: MirceaKitsune
- IRC: Taoki
- In-game: MirceaKitsune
- Location: Romania, Bucharest
- Contact:
Re: Default formspec appearance
I'm happy to announce that yesterday, the integration of minetest_next into minetest_game has made this come true. Formspecs in any mod can now include the following defaults in their string:
Doing so gives the formspec an appearance defined in minetest_game, which other games based on it can of course change. This does of course require every mod to include the lines in its formspec... which I am doing at this moment for the stuff I still maintain, and recommend others to do. Either way, it makes what I was looking for possible at last.
Code: Select all
default.gui_bg..default.gui_bg_img..default.gui_slots..
Who is online
Users browsing this forum: ywwv and 5 guests