You can send us your project by clicking the “Report a Bug” link at the top of this webpage. But we’ll probably won’t have time to look into it this week since we have a major holiday (Thanksgiving) this week. So, let’s see if we can narrow it down.
>> But I didn’t feel any fps drop, my game still run smoothly.
Hmm… that’s interesting. I’ve never seen that before. Just to confirm, would you mind adding the following code to your “main.lua” file please? This will print the average FPS once a second to your Visual Studio “Output” panel. Double check to see if dragging your finger onscreen is causing any large dips in the framerate. If it’s not, then yeah, it sounds like touch events are being delivered late on the Microsoft Silverlight side.
local lastEnterFrameTime = nil local durationCollectionSize = 60 local durationCollectionIndex = 1 local durationCollection = {} for index = 1, durationCollectionSize do durationCollection[index] = 0 end local function onEnterFrame(event) local currentTime = system.getTimer() -- If this is the first frame, then fetch the current time and exit out. if (lastEnterFrameTime == nil) then lastEnterFrameTime = currentTime return end durationCollection[durationCollectionIndex] = currentTime - lastEnterFrameTime lastEnterFrameTime = currentTime if (durationCollectionIndex \< durationCollectionSize) then durationCollectionIndex = durationCollectionIndex + 1 return end local averageDuration = 0 for index = 1, durationCollectionSize do averageDuration = averageDuration + durationCollection[index] end averageDuration = averageDuration / durationCollectionSize local averageFps = 1000 / averageDuration print("Average FPS = " .. tostring(averageFps) .. ", Average Duration = " .. tostring(averageDuration)) durationCollectionIndex = 1 end Runtime:addEventListener("enterFrame", onEnterFrame)
If the touch delay is coming from the .NET side for whatever reason, some feature that your app is using must be causing it. Are you using any 3rd party libraries such as AdMob? I remember AdMob would cause some random lag, but it was to the main UI thread as a whole which affected the framerate too. You might want to try commenting out features like that to see if that’s where the issue is coming from.