Alright here is some code, still not sure why this should matter as it is the exact same code running on both the Roku 2 and the Roku 3, yet the Roku 2 has 5x the frame rate.
Main while loop
calls to other objects, one of them is an implementation of dnode for socket events could that be causing it?
in this case m.mode = "game"
while m.running
if m.mode = "game"
m.gameModeObject.gameLoop()
m.timerManager.handleTimers()
delay = 1
else
delay = m.timerManager.handleTimers()
end if
msg = wait(delay, m.port)
if msg <> invalid
if type(msg) = "roSocketEvent"
m.dnode.update(msg)
else if type(msg) = "roChannelStoreEvent"
storeSvc.update(msg)
else
m.sManager.update(msg)
End If
end if
end while
The implementation of the "gameModeObject" from the above code
function gameScreen(msgPort as object) as object
this = {
s: CreateObject("roScreen")
time: CreateObject("roTimespan")
fr: CreateObject("roFontRegistry")
elapsed: 0
lastTime: 0
current: 0
start: 0
}
this.init = function()
m.s.SetMessagePort(m.port)
m.s.clear(&hff954aFF)
m.s.setAlphaEnable(true)
'draw a simple rectangle on the screen once and nothing else
m.s.drawRect(0, 0, 264, 720, &hff95ffFF)
end function
this.drawLoop = function(dt as dynamic)
if dt <= 0 then stop
'fps counter
m.s.DrawRect(1115, 0, 200, 50, &hff954aFF)
m.s.DrawText("fps: " + toString(1000 / dt), 1120, 0, &hFFFFFF, m.fr.GetDefaultFont())
m.s.finish()
end function
this.gameLoop = function()
m.lastTime = m.current
'm.time.mark()
m.current = m.time.totalmilliseconds() - m.start
m.elapsed = (m.time.totalmilliseconds() - m.start) - m.lastTime
m.drawLoop(m.elapsed)
end function
this.init()
return this
end function