+William Posted February 17, 2019 Posted February 17, 2019 Bom, criei um "complemento" para um hud já existente, mas ele foi criado em uma pasta diferente. Então, criei a hud, estava funcionando(minha resolução 1280x720), so que, quando testo em outras resoluções(1366x766; 1360;760; etc) ela buga ( https://prnt.sc/mm5y2w aqui ela está em 1366x768) Qual pode ser o erro? Segue abaixo: local screenW, screenH = guiGetScreenSize() local resW, resH = 1366, 768 local x, y = ( screenW/resW ), ( screenH/resH ) function drawHUD() local estrelasprocurado = getPlayerWantedLevel (localPlayer) local ArmaAtual = getPedWeapon(localPlayer) local MunicaoPente = getPedAmmoInClip (localPlayer) local MunicaoTotal = getPedTotalAmmo (localPlayer) dxDrawImage(x*0.8430, y*0.0375, x*0.2000, y*0.1778, ":[BR]HUDRPComplemento/img/"..ArmaAtual..".png", 0, 0, 0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*1142, y*187, x*80, y*0, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0.8945, y*0.2014, x*0.1039, y*0.0306, tocolor(0, 0, 0, 109), false) dxDrawText("Munição: "..MunicaoPente.."/"..MunicaoTotal, x*1161, y*135, x*1268, y*177, tocolor(255, 255, 255, 255), 1.00, "default", "center", "center", false, false, false, false, false) dxDrawRectangle(x*0.7867, y*0.0431, x*0.0000, y*0.0306, tocolor(255, 255, 255, 255), false) dxDrawRectangle(x*0.7867, y*0.0431, x*0.1016, y*0.0306, tocolor(0, 0, 0, 84), false) dxDrawText("Estrelas: "..estrelasprocurado, x*1034, y*37, x*1114, y*51, tocolor(255, 255, 255, 255), x*0.98, "default", "center", "top", false, false, false, false, false) dxDrawRectangle(x*873, y*31, x*130, y*22, tocolor(0, 0, 0, 84), false) dxDrawText("Desempregado", x*898, y*37, x*961, y*51, tocolor(255, 255, 255, 255), x*0.95, "default", "left", "top", false, false, false, false, false) dxDrawLine(x*874, y*51, x*874, y*51, tocolor(255, 255, 255, 255), x*1, false) dxDrawLine(x*873, y*53, x*1002, y*53, tocolor(255, 255, 255, 255), x*1, false) dxDrawLine(x*1008, y*53, x*1137, y*53, tocolor(255, 255, 255, 255), x*1, false) dxDrawLine(x*1147, y*167, x*1276, y*167, tocolor(255, 255, 255, 255), x*1, false) end addEventHandler("onClientRender", getRootElement(), drawHUD) function toggleRadar() if isVisible then addEventHandler("onClientRender", root, drawHUD ) else removeEventHandler("onClientRender", root, drawHUD ) end isVisible = not isVisible end bindKey ("F11", "down", toggleRadar) local hudTable = { "ammo", "armour", "clock", "health", "money", "weapon", "wanted", "area_name", "vehicle_name", "breath", "clock" } addEventHandler("onClientResourceStart", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, false) end end ) addEventHandler("onClientResourceStop", resourceRoot, function() for id, hudComponents in ipairs(hudTable) do showPlayerHudComponent(hudComponents, true) end end )
Other Languages Moderators Lord Henry Posted February 17, 2019 Other Languages Moderators Posted February 17, 2019 A HUD da print não é a mesma do código. Está faltando partes.
+William Posted February 17, 2019 Author Posted February 17, 2019 (edited) Sim eu sei, pois esse dai é um complemento de uma hud já existente, o mesmo acontece com o level ali embaixo, mas não vem ao caso. Edited February 17, 2019 by +William Complemento da frase
Other Languages Moderators Lord Henry Posted February 17, 2019 Other Languages Moderators Posted February 17, 2019 Esse HUD aparece direito somente na resolução 1280x720, mas vc quer fazer aparecer corretamente nas demais resoluções, é isso?
Other Languages Moderators Lord Henry Posted February 17, 2019 Other Languages Moderators Posted February 17, 2019 Então pq vc colocou 1366, 768 na linha 3?
+William Posted February 17, 2019 Author Posted February 17, 2019 Aí eu não sei, ta bugando, em 1280x720 funciona mas em 1366x768 não, não entendi nada kkk
+William Posted February 19, 2019 Author Posted February 19, 2019 Como faço para funcionar em outras resoluções? Alem do 1280x720, 1366x768?
DNL291 Posted February 19, 2019 Posted February 19, 2019 Você deve definir a resolução que você fez a interface na linha 3 e não outra resolução que esteja dando problemas. Além disso, se você quer mesmo ajustar as dimensões de cada elemento bem como as posições, tenha em mente que será necessário outros cálculos, como ajustar o tamanho da fonte do texto-dx.
Other Languages Moderators Lord Henry Posted February 19, 2019 Other Languages Moderators Posted February 19, 2019 Também tem a função dxSetAspectRatioAdjustmentEnabled.
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