Jump to content

[HELP] dxLib.


iwalidza

Recommended Posts

iam just try to make dxLib

iam make a function to make a window its work good
but i need make somthing like setFont or anyother function to edit for this window how i can do it
code
 

local windows = {}

function drawWindow(x,y,width,heigh,titel,titelSize,font,borderColor,bgColor,closeBnt,postGUI)
    local element = createElement('dxWindow')
        if element then

            borderColor = borderColor or tocolor(15,15,15,155)
            bgColor = borderColor or tocolor(15,15,15,255)
            postGUI = postGUI or false

            local index = table.maxn(windows) + 1
            windows[index] = {}
            windows[index][1] = element
            windows[index]["x"] = tonumber(x)
            windows[index]["y"] = tonumber(y)
            windows[index]["width"] = tonumber(width)
            windows[index]["heigh"] = tonumber(heigh)
            windows[index]["titel"] = tostring(titel)
            windows[index]["font"] = font or "sans"
            windows[index]["borderColor"] = borderColor or tocolor(15,15,15,155)
            windows[index]["bgColor"] = bgColor or tocolor(15,15,15,255)
            windows[index]["postGUI"] = postGUI or false
            windows[index]["titelSize"] = titelSize or 1
            windows[index]["closeBnt"] = closeBnt or false
        end
end

function drawWin()

    for i, window in ipairs(windows) do
        local x = window["x"]
        local y = window["y"]
        local width = window["width"]
        local heigh = window["heigh"]
        local titel = window["titel"]
        local borderColor = window["borderColor"]
        local bgColor = window["bgColor"]
        local postGUI = window["postGUI"]
        local font = window["font"]
        local titelSize = window["titelSize"]
        local closeBnt = window["closeBnt"]

        roundedRectangle(x, y, width, heigh, borderColor, bgColor, postGUI)
        dxDrawText (titel, x+5 ,y+5, width, heigh, white, titelSize, font)

        if closeBnt == true then
            bntX = x - 19 + width
            dxDrawText ("X", bntX ,y+5, 10, 10, tocolor(215,15,15,255), 1, "default-bold")
        end
    end
end

addEventHandler("onClientRender",root,drawWin)



drawWindow(700,100,200,200,"default",1,coolvetica,false,false,true,false)

 

Link to comment
local windows = {}

function drawWindow(x,y,width,heigh,titel,titelSize,font,borderColor,bgColor,closeBnt,postGUI)
    local element = createElement('dxWindow')
        if element then

            borderColor = borderColor or tocolor(15,15,15,155)
            bgColor = borderColor or tocolor(15,15,15,255)
            postGUI = postGUI or false

            local index = table.maxn(windows) + 1
            windows[index] = {}
            windows[index][1] = element
            windows[index]["x"] = tonumber(x)
            windows[index]["y"] = tonumber(y)
            windows[index]["width"] = tonumber(width)
            windows[index]["heigh"] = tonumber(heigh)
            windows[index]["titel"] = tostring(titel)
            windows[index]["font"] = font or "sans"
            windows[index]["borderColor"] = borderColor or tocolor(15,15,15,155)
            windows[index]["bgColor"] = bgColor or tocolor(15,15,15,255)
            windows[index]["postGUI"] = postGUI or false
            windows[index]["titelSize"] = titelSize or 1
            windows[index]["closeBnt"] = closeBnt or false
    
			return index
        end
end 

function editWindow ( windowIndex , size )
	windows[windowIndex]["titelSize"] = size
end

window = drawWindow(700,100,200,200,"default",1,coolvetica,false,false,true,false)
editWindow ( window , 5 )

 

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