Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function inrct(x,y,x1,y1,x2,y2)
- return x>=x1 and x<=x2 and y>=y1 and y<=y2
- end
- function exptov(a)
- return 2+(1.15^(40*a))
- end
- function vtoexp(a)
- return math.log(a-2)/math.log(1.15)/40
- end
- local al=0
- local spd=24
- local wx,wy,ww,wh=586,50,25,250
- local expv=vtoexp(61)
- local fps=61
- local tfps=61
- local lt=0
- local afps=61
- function step()
- local x,y=tpt.mousex,tpt.mousey
- if (al>0 and inrct(x,y,wx,wy,wx+ww,wy+wh))or inrct(x,y,612,96,650,151) then
- al=al+spd
- if al>255 then al=255 end
- else
- al=al-spd
- if al<0 then al=0 end
- end
- tpt.drawrect(wx,wy,ww,wh+24,255,255,255,al)
- tpt.fillrect(wx,wy,ww-2,wh+12,0,0,0,al)
- tpt.drawrect(wx+3,wy+3,ww-6,wh-6,255,255,255,al)
- if tfps-1>fps then
- fps=fps+1
- tpt.setfpscap(fps)
- elseif tfps+1<fps then
- fps=fps-1
- tpt.setfpscap(fps)
- elseif tfps~=fps then
- fps=tfps
- tpt.setfpscap(fps)
- end
- local t=os.clock()
- afps=1/(t-lt)
- lt=t
- local h=(wh-8)*expv
- tpt.fillrect(wx+3,wy+wh-5-h,ww-8,h,0,0,255,al)
- local h=(wh-8)*vtoexp(fps)
- tpt.fillrect(wx+3,wy+wh-5-h,(ww-8)/2,h,255,0,255,al/2)
- local h=(wh-8)*vtoexp(afps)
- tpt.fillrect(wx+3+(ww-8)/2,wy+wh-5-h,(ww-8)/2,h,255,0,0,al/2)
- tpt.drawtext(wx+5,wy+wh,math.floor(exptov(expv)),128,128,255,al)
- tpt.drawtext(wx+5,wy+wh+8,math.floor(fps),255,128,255,al)
- tpt.drawtext(wx+5,wy+wh+16,math.floor(afps),255,128,128,al)
- end
- function mouse(x,y,b,n)
- if al>0 then
- if inrct(x,y,wx+4,wy+4,wx+ww-4,wy+wh-4) then
- expv=1-(y-wy-4)/(wh-8)
- tfps=exptov(expv)
- end
- if inrct(x,y,wx,wy,wx+ww,wy+wh) then
- return false
- end
- end
- end
- tpt.register_step(step)
- tpt.register_mouseclick(mouse)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement