Page 1 of 1

Question regarding callbacks in LOVE

Posted: Mon Mar 31, 2014 5:11 am
by KareemErgawy
Hi,
During the past weekend I started exploring LOVE source code. I'll be working on LOVE mainly to enhance and build my engine programming skills. I would like to thank LOVE developers for the wonderful game engine.

Currently I studying how Lua integration is implemented. I managed to discover many details through debugging the code. Aspects such as Lua scripting engine initialization, SDL integration, wrapping C++ classes/modules to be exposed to Lua, and handling mouse and joystick events are now apparent to me.

I wanted to ask how are some callbacks are implemented? Specifically, love.draw, love.load, and love.run.

I don't need detailed explanation. Just pointers to the code on where I can debug and understand the C++ and Lua parts that are involved in implementing such callbacks.

Side note: I am studying Lua integration because I am thinking of integrating Mono runtime (specially C#) with the LOVE engine. If this is interesting to anybody in the community, I will be happy work in a team. I am doing this for fun and maybe, LOVE community may adopt this integration as another option besides Lua.

Re: Question regarding callbacks in LOVE

Posted: Mon Mar 31, 2014 5:48 am
by slime
KareemErgawy wrote:I wanted to ask how are some callbacks are implemented? Specifically, love.draw, love.load, and love.run.

I don't need detailed explanation. Just pointers to the code on where I can debug and understand the C++ and Lua parts that are involved in implementing such callbacks.
The code for the callback functions are all in src/scripts/boot.lua. love.update and love.draw are called by love.run, which is called by the function returned by boot.lua (which is called by the executable, in src/love.cpp.)

love.run also polls events every frame, and invokes the callback functions for those events.

Re: Question regarding callbacks in LOVE

Posted: Tue Apr 01, 2014 11:21 am
by KareemErgawy
slime wrote: The code for the callback functions are all in src/scripts/boot.lua. love.update and love.draw are called by love.run, which is called by the function returned by boot.lua (which is called by the executable, in src/love.cpp.)

love.run also polls events every frame, and invokes the callback functions for those events.
Thanks a lot slime