Hey everyone,
I just started using Defold and Lua and browsing the documentation I haven’t been able to understand one thing about message passing: who are the reicever of the API default messages such as draw_line
?
Suppose I am writing a custom renderer which is able to respond to draw_rect
by drawing the four sides of a rectangle using four draw_line
calls .
How would I do it?
Both
elseif message_id == hash("draw_rect") then self.draw_line(message.rect, {start_point = message.rect.bottomLeft, end_point = message.rect.bottomRight, color = message.color })
and
elseif message_id == hash("draw_rect") then draw_line(message.rect, {start_point = message.rect.bottomLeft, end_point = message.rect.bottomRight, color = message.color })draw_line
rise a nil exception on draw_line
, so I assume that the function is neither global or indexed on the renderer metatable.
Would I have to post four draw_line
messages from the renderer to the engine?
Thanks in advance for your answer!