How to GUI in Defold

I would love to understand more that Hex map, anyone has any source how this can be achieved in defold?

I don’t understand the relevance of this question to the ‘How to GUI in Defold’ topic!?

There is nothing special about hex maps related to any engine. You can use gameobjects and factories to create maps. The most challenging part is the math. You can find very detailed information here: Hexagonal Grids

My hex example using Defold : GitHub - selimanac/defold-astar-hex-example

3 Likes

I don’t see such line in menu.

Also when generating Widget it seems that lua file is just a stub and missing scheme and all buttons and text subcomponents from gui.


this gui file produces this lua code:

local M = {}
function M:init()
	-- Now we have next functions to use here:
	-- self:get_node([node_id]) -- Get node inside widget by id
	-- self.druid to access Druid Instance API, like:
	-- self.druid:new_button([node_id], [callback])
	-- self.druid:new_text([node_id], [text])
	-- And all functions from component.lua file
	self.root = self:get_node("root")
	self.button = self.druid:new_button("button", self.on_button, self)
end
function M:on_button()
	print("Root node", self.root)
end
return M

Did I missed some setup steps? Using druid 1.1.4

Hello! Yea, print GUI Scheme was removed and current best approach - just use the node_id like “button_counter” in relative places (ex self.druid:new_button("button_counter"))

Yea, since 1.1 Druid will make only a default placeholder for widget without any GUI nodes inspection and placeholders creation for the components. So you need to describe component manually, probably in init function, ex:

self.text_counter = self.druid:new_text("text_counter")
self.button_booster = self.druid:new_button("button_booster", on_button_booster)
...

The widget template can be changed inside Edit -> Druid Settings, by default it is template you provided. You can select a “minimal” template without comments or provide your custom file. But also without parsing node names to create a placeholders

1 Like

Thank you! I will use this approach.

1 Like