Jump to content

dxDrawMultiProgressBar


Recommended Posts

Bueno dejo este pequeño aporte que sirve para hacer barras progresivas compuestas por varios dxrectangle 

 

   function dxMultiProgressBar(tprogreso, progreso, barras, posx, posy, ancho, largo, r, g, b, a, r2, g2, b2 ,a2) 
      local distance   = ( (ancho / 10) * 3) / (barras - 1)
      local bancho     = (( ancho / 10) * 7) / barras
	  local pbarra     = ( tprogreso / barras)
	  local tbarras    = math.ceil( progreso / pbarra)
	  local data1      = pbarra - (( pbarra  * tbarras) - progreso)
	  local prbarra    = bancho * ( data1 / pbarra)
	  local cache      = 0
	  for i = 1, barras do
          dxDrawRectangle(posx + cache , posy, bancho, largo, tocolor(r2, g2, b2, a2))
	    if i < tbarras then
		  dxDrawRectangle(posx + cache , posy, bancho, largo, tocolor(r, g, b,a))
	    elseif i == tbarras then
	      dxDrawRectangle(posx + cache , posy, prbarra, largo, tocolor(r, g, b,a))
	    end
	     cache = cache + bancho + distance
	  end
   end
-------------------------------------
-- ejemplo ---
local hp = localPlayer:getHealth()
dxMultiProgressBar(100, hp, 8, 800, 500, 100, 20, 0, 200, 0, 255, 30, 30, 30 ,255) 

04bce42e562d4d218d7a034c4e6545ae.png

Edited by alex17"
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...