Simple FPS Meter

  • FeynmanLogomaker
    15th Jul 2013 Member 1 Permalink

    Very simple design, no frills. To use it, just click and drag the bar to the desired FPS.

     

    Current: V.1.2 - Added Reset button

     

    local cF = 0
    local cX = 60
    function fpsbar()
    tpt.drawrect(4,354,200,12,255,255,255,255)
    tpt.fillrect(205,354,tpt.textwidth("Reset") + 5,12,255,255,255,255)
    tpt.drawtext(208,357,"Reset",0,0,0,255)
    tpt.fillrect(5,355,cX,10,255,255,255,255)
    tpt.drawtext(4,346,"Target FPS: " .. cX .. ", Current FPS: " .. math.floor(cFPS),255,255,255,150)
    tpt.setfpscap(cX)
    end
    function mTest()
    if tpt.mousex >= 10 and tpt.mousex <= 204 and tpt.mousey >= 355 and tpt.mousey <= 375 then
    cX = tpt.mousex - 4
    elseif tpt.mousex >= 205 and tpt.mousex <= 205 + tpt.textwidth("Reset") + 5 and tpt.mousey >= 354 and tpt.mousey <= 366 then
    cX = 60
    end
    end
    function currentFPS()
    f=os.clock()
    cFPS=1/(f-cF)
    cF=f
    tpt.fillrect(5, 355,cFPS,10,0,155,0,155)
    end
    tpt.register_mouseclick(mTest)
    tpt.register_step(fpsbar)
    tpt.register_step(currentFPS)

  • fireball5000
    15th Jul 2013 Member 0 Permalink
    [REDACTED]
  • hittox
    15th Jul 2013 Member 0 Permalink

    @FeynmanLogomaker (View Post)

    Nice, I find this useful! This should be added to the top right buttons and the letter would be ''F'' :D

  • FeynmanLogomaker
    16th Jul 2013 Member 0 Permalink

    OK, so you built one too. Yours is a bit fancier, but mine works just as well.

     

    BTW: @Hittox: Thanks! I might try to do that - I've been working on making it toggle anyways.