Jump to content

DX Screen Help


Recommended Posts

I want this to be right in the middle of all screen sizes.

local x, y        = guiGetScreenSize();
local h         = 32;
local rot        = 0;
local exists     = {};

function drawLoader ()
    if not mods then return; end
    if next (mods) then
        rot = rot + 1;
        local count = 0;
        for _ in pairs (exists) do 
            count = count + 1;
        end
        
        local progress = count.."/"..#mods.." (%"..math.ceil((count/#mods)*100)..")";
        
        if count == #mods then 
            if getTickCount() > tick then 
                removeEventHandler ("onClientRender", root, drawLoader);
                return;
            end    
        end
        
        local rx, ry, rw, rh = 0, y-h, x/10, h;
        dxDrawImage (rx + 3, ry-4, 42, 42, "icon.png", rot, 0, 0);
        addOutlines (rx, ry, rw, rh, tocolor (150, 150, 150, 75), 2);
        dxDrawRectangle(rx, ry, rw, rh, tocolor(0, 0, 0, 125), false);
        dxDrawText (progress, rx + 42, ry, rw, (y-h) + h, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center");
    end    
end

function addOutlines(x, y, width, height, lineColor, lineSize, postGUI)
    dxDrawLine(x - 1, (y - lineSize), x - 1, y + height + (lineSize - 1), lineColor, lineSize, postGUI); --left 
    dxDrawLine(x + width, (y) - 1, (x) - 1, (y) - 1, lineColor, lineSize, postGUI); -- top
    dxDrawLine((x) - 1, y + height, x + width, y + height, lineColor, lineSize, postGUI); -- bottom
    dxDrawLine(x + width, y - lineSize, x + width, y + height + (lineSize - 1), lineColor, lineSize, postGUI); -- right
end

 

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...