..:D&G:.. Posted June 19, 2016 Posted June 19, 2016 Hi guys, so I am starting to use dx drawn windows, but it's too much code in the script for a small window, so I want to make a script which keeps the main code of the window, and I want to be able to only call a function and create a window from this scripts, instead of having to write a new piece of code for another window, something like mabako's "gui" resource from MTA Paradise. So here is the main window code: function drawWindow(x, y, width, height, winName) dxDrawLine(751 - 1, 264 - 1, 751 - 1, 656, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(1262, 264 - 1, 751 - 1, 264 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(751 - 1, 656, 1262, 656, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(1262, 656, 1262, 264 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawRectangle(751, 264, 511, 392, tocolor(0, 0, 0, 180), false) dxDrawLine(751 - 1, 264 - 1, 751 - 1, 288, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(1262, 264 - 1, 751 - 1, 264 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(751 - 1, 288, 1262, 288, tocolor(254, 254, 254, 254), 1, false) dxDrawLine(1262, 288, 1262, 264 - 1, tocolor(254, 254, 254, 254), 1, false) dxDrawRectangle(751, 264, 511, 24, tocolor(75, 2, 130, 254), false) dxDrawText(winName, 775 - 1, 262 - 1, 1217 - 1, 288 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(winName, 775 + 1, 262 - 1, 1217 + 1, 288 - 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(winName, 775 - 1, 262 + 1, 1217 - 1, 288 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(winName, 775 + 1, 262 + 1, 1217 + 1, 288 + 1, tocolor(0, 0, 0, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText(winName, 775, 262, 1217, 288, tocolor(255, 255, 255, 255), 1.00, "default-bold", "center", "center", false, false, false, false, false) dxDrawText("X", 1217 - 1, 263 - 1, 1262 - 1, 288 - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("X", 1217 + 1, 263 - 1, 1262 + 1, 288 - 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("X", 1217 - 1, 263 + 1, 1262 - 1, 288 + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("X", 1217 + 1, 263 + 1, 1262 + 1, 288 + 1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) dxDrawText("X", 1217, 263, 1262, 288, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "center", "center", false, false, false, false, false) end This is how it looks like: I have no idea how to do this... so, any ideas? Thanks.
TRtam Posted June 19, 2016 Posted June 19, 2016 Something like this? function drawWindow(title, x,y, width,height) dxDrawRectangle(x,y, width,height, tocolor(0,0,0, 180)) dxDrawRectangle(x,y, width,24, tocolor(75,2,130, 254)) dxDrawLine(x,y, x+width,y, nil, 1) dxDrawLine(x,y, x,y+height, nil, 1) dxDrawLine(x+width,y, x+width,y+height, nil, 1) dxDrawLine(x,y+height, x+width,y+height, nil, 1) dxDrawLine(x,y+24, x+width,y+24, nil, 1) dxDrawText(title, x-1,y-1, x+width, y+24, tocolor(0,0,0), 1, 'default-bold', 'center','center') dxDrawText(title, x+3,y+3, x+width, y+24, tocolor(0,0,0), 1, 'default-bold', 'center','center') dxDrawText(title, x+1,y+1, x+width, y+24, nil, 1, 'default-bold', 'center','center') dxDrawText('X', x-1,y-1, x+width-1, y+24, tocolor(0,0,0), 1, 'bankgothic', 'right','center') dxDrawText('X', x+3,y+3, x+width-1, y+24, tocolor(0,0,0), 1, 'bankgothic', 'right','center') dxDrawText('X', x+1,y+1, x+width-1, y+24, nil, 1, 'bankgothic', 'right','center') end
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now