getting tool tips to work

janitor61
New member
 
Posts: 3
Joined: Sat Nov 26, 2011 03:16

getting tool tips to work

by janitor61 » Wed Dec 07, 2011 06:46

https://gist.github.com/1441721

(actual .cpp edits start at 486)

I am able to get the tool tip reading out the information on hover, and I could write out InventoryItem->getText(), which gives me a string like "1 blahblah 2", so I decided to add descriptions in init.lua and try to percolate them through the various objects and interfaces, all to no avail. Strangely enough the "Wooden Plank" works fine, but everything else is blank.

I've added the description member to the serialization methods in ContentFeatures (for nodes), and the IToolDefManager and ICraftItemDefManager implementors, I can't think of what else I need to do. Any thoughts?
Last edited by janitor61 on Wed Dec 07, 2011 06:48, edited 1 time in total.
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28

by dannydark » Wed Dec 07, 2011 12:11

@Janitor61: I can't currently help out as I'm on my work computer, but I will try and have a look when I get home from work. Tool tips have been needed for some time now so its great to see somebody working on them ^_^
 

janitor61
New member
 
Posts: 3
Joined: Sat Nov 26, 2011 03:16

by janitor61 » Wed Dec 07, 2011 17:52

oh, and here's my branch: https://github.com/janitor61/minetest/tree/testbranch (apologies for the nondescript name)

If all else fails I suppose I could add a dictionary for the description names using the InventoryItem->getText() return as a key with something like irr::core::map...
 

kahrl
Member
 
Posts: 236
Joined: Fri Sep 02, 2011 07:51

by kahrl » Thu Dec 08, 2011 05:42

You defined "std::string getDescription()" in InventoryItem and MaterialItem, but "std::string getDescription() const" in CraftItem and ToolItem. These are different overloads.
 

janitor61
New member
 
Posts: 3
Joined: Sat Nov 26, 2011 03:16

by janitor61 » Thu Dec 08, 2011 09:46

kahrl wrote:You defined "std::string getDescription()" in InventoryItem and MaterialItem, but "std::string getDescription() const" in CraftItem and ToolItem. These are different overloads.


You're right - thank you for pointing that out; I was able to get this to work, updated my fork and made a feature branch:

https://github.com/celeron55/minetest/pull/31
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28

by dannydark » Thu Dec 08, 2011 12:01

Nice work Janitor61 ^_^ I'll definitely be merging this when I get home.
 

User avatar
dannydark
Member
 
Posts: 428
Joined: Fri Aug 12, 2011 21:28

by dannydark » Sat Dec 10, 2011 16:00

Been playing around with this and I like it, my only criticism is that you used buttons for the tooltip I would have thought that making the tooltip static text with a slightly transparent background would have been better.
 


Return to Minetest Engine

Who is online

Users browsing this forum: No registered users and 22 guests

cron