Background
I am currently creating an XNA application that utilizes LuaInterface so that I can control the application with Lua scripts.
What I Want
I've noticed that a lot of things will probably be 'time' based in my development. Such things may include showing information and then removing it after x amount of seconds, end a game in defeat if it takes x amount of seconds, or even used in easing a camera a certain distance every x seconds. I wanted to implement the wait
function in Lua as opposed to my application, but at this point, I'm open to input (because I can't seem to get it to work).
What I've Tried So Far
inv.lua
_G.Wait=(function(t)
local dest=Time.ElapsedMilliseconds+t*1000
while Time.ElapsedMilliseconds<dest do
gel:UIUpdate()
end
return true
end)
--Aliases
_G.wait=Wait
gELua.vb
Public Sub UIUpdate()
Application.DoEvents()
Game.Tick()
End Sub
(Where Game
is My XNA Game Object)
So Why Doesn't My Idea Work?
The current problem is that, even though I'm calling Game.Tick()
every time to keep everything going, the XNA part of my application stops receiving input.
So, my question is, is there a better way to do this? I thought it was working pretty well until I encountered the problem with user input. Have any of you implemented something like this that worked well?