Quick Links: Download Gideros Studio | Gideros Documentation | Gideros community chat | DONATE
Need a live fps rate — Gideros Forum

Need a live fps rate

GeoCoderGeoCoder Member
edited May 2014 in General questions
I am working on a benchmark project for Gideros. The purpose is to determine how many animated sprites could be rendered smoothly at 60 fps. I need a method to determine a live fps rate. I tried Application:getFPS() method but it does not change a bit when you added a lot more of animated sprites to the stage. Someone here already has the method or a class?

I would very much appreciate the info. Thanks.

PS I am still new to Gideros, learning more at times.

Comments

  • HubertRonaldHubertRonald Member
    Accepted Answer
    Hi @GeoCoder welcome to Gideros

    You can do something like this
    -- measure memory and frames per seconds (fps)
    frame = 0
    timer = os.timer()
    qFloor = math.floor -- optimization
     
    function displayFps(event)
    	frame = frame + 1
    	if frame == 60 then
    		local currentTimer = os.timer()
    		print("fps: "..qFloor(60 / (currentTimer - timer)), " ,Texture Memory:", application:getTextureMemoryUsage()/1024, "Mb")
    		frame = 0
    		timer = currentTimer
    		--print ("memory used: "..qFloor(collectgarbage("count")/1000),"Mb") -- optional
    	end
     
    end
     
    -- Add fps counter to stage
    stage:addEventListener(Event.ENTER_FRAME, displayFps)
  • I didn't realize how easy to implement fps rate in Gideros. Thanks.
Sign In or Register to comment.