I’m creating an inventory screen for my game. I’m using Java builders to build the grid section of the screen that consist of droppable controls. I’m trying to - for testing purposes - add a hover effect when creating these controls that will display a hint message. All resources I’ve found online use XML to create the effects, but I need to find a way to create these effects dynamically. I’ve noticed the onHoverEffect() method in the builder, but there doesn’t seem to be any way to add a hint effect to it. Could someone please explain how this can be done?
page 90 of this file I believe.
While this will undoubtedly prove useful, I’m not currently looking on how to start effects, but how to create them through the Java builders.
I need to find a way to create them in Java because they hints need to be dynamic; the hints will be the name of the item you hover over in your inventory. As far as I can tell, you can only create constant effects in XML.
Well the bible file I pointed you to has all documentation on everything. If it’s not in there, I doubt it will be anywhere, though the guy that made nifty does frequent these forums, and usually responds if you summon him.
[java]
onHoverEffect(new HoverEffectBuilder(“hint”){{
getAttributes().setAttribute(“hintText”, “Here is a hint!”);
}});
[/java]
That is how I set it in my game. All the other hover effects follow a similar format.
@glh3586 said: [java] onHoverEffect(new HoverEffectBuilder("hint"){{ getAttributes().setAttribute("hintText", "Here is a hint!"); }}); [/java]That is how I set it in my game. All the other hover effects follow a similar format.
I see! I should be able to use this as well, thank you!
As for the Nifty Bible, I’ve been meaning to take a look at it but I haven’t had much time. I’ve been trying to get the information I need through the wiki and Google, but it sounds like the book as a lot more than what I can find.