Re: Where do you check for keyboard input
Posted: Wed Jul 15, 2009 10:08 pm
Your link is in the context of lua when bound to C++, not the context of a C++ engine wrapped with lua (the way LOVE functions).Zorbatron wrote:I'm going by what I learn from websites, personal tests, and concrete evidence, not my opinion.bartbes wrote:This is a matter of personal style, and one could argue that saving every pressed character presents other overhead, which might outweigh the overhead created by using love.keyboard.isDown. Furthermore, on most modern computers resources are not that limited that it really matters.
Once again, despite my tone, I mean no offense.
Source: http://lua-users.org/lists/lua-l/2004-04/msg00164.html (scroll to the section "Binding Lua to C++")
Just want you to realise alot of this stuff isn't my opinion as much as it is the opinions of people who've done alot of research.Source wrote: Avoid using Lua in "every frame" actions as performance drops
dramatically. For example, don't use Lua to do animation updates; set
up parameters for the animation in Lua and do the updates in C/C++
code.
How do you propose I check if a key continues to be held down after it is pressed? Save a list of each key with a pressedDown boolean that I flip on keypressed and keyreleased? I didn't make LOVE but I'm pretty sure if you ask one of the guys who did, they'd say that that's more overhead than isDown since isDown is likely just referencing a constantly updated list to see if a key is down.