Zaloguj się by uzyskać pełen dostęp. Nie masz jeszcze konta? Założ je już teraz w kilka sekund.

Wysłany: 2017-12-23, 00:54


Daybreak







Wiek: 27
Na forum: 3693 dni
Posty: 30

Piwa: 2

Respekt: 50

Witam mam taki problem bo chcia?bym zaokr?gli? przycisk w panelu logowania lecz nie wiem jak to zrobi? wie ktos mo?e jak to zrobi?? nie chce majstrowa? przy tym by nie zmniejszy? przypadkiem przycisku lub zepsu? kodu za ka?d? pr?b? pomocy wynagradzam piwem <3

taki jest kod


else dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false) end
if not isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false)

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-23, 12:08


Kalizman







Wiek: 23
Na forum: 3652 dni
Posty: 1394

Piwa: 4619

Respekt: 358,8
Respekt: 358,8Respekt: 358,8Respekt: 358,8Respekt: 358,8

To jest funkcja:

function roundedRectangle(xywhborderColorbgColorpostGUI)
    if (and and and hthen
        if (not borderColorthen
            borderColor tocolor(000200);
        end
        
        if (not bgColorthen
            bgColor borderColor;
        end
        
        --> Background
        dxDrawRectangle(xywhbgColorpostGUI);
        
        --> Border
        dxDrawRectangle(2141borderColorpostGUI); -- top
        dxDrawRectangle(2h41borderColorpostGUI); -- bottom
        dxDrawRectangle(1214borderColorpostGUI); -- left
        dxDrawRectangle(w214borderColorpostGUI); -- right
    end
end

?r?d?o: https://forum.mtasa.com/topic/63551-helprounded-rectangle/

Stosowanie:

roundedRectangle(whwhtocolor(rgba))

Powinno dzia?a?

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-23, 13:08


.RiV







Wiek: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

Poprawka

function roundedRectangle(xywhborderColorbgColorpostGUI)
    if (and and and hthen
        if (not borderColorthen
            borderColor tocolor(000200);
        end
        
        if (not bgColorthen
            bgColor borderColor;
        end
        
        --- Background
        dxDrawRectangle(xywhbgColorpostGUI);
        
        --- Border
        dxDrawRectangle(2141borderColorpostGUI); -- top
        dxDrawRectangle(2h41borderColorpostGUI); -- bottom
        dxDrawRectangle(1214borderColorpostGUI); -- left
        dxDrawRectangle(w214borderColorpostGUI); -- right
    end
end


Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-23, 19:58


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-23, 21:20


Daybreak







Wiek: 27
Na forum: 3693 dni
Posty: 30

Piwa: 2

Respekt: 50

A moglibyscie wytlumaczyc jak to do kodu wype?ni?? bardzo bym by? wdzi?czny tak wygl?da ca?y kod


Kod:


if getElementData(localPlayer, "player:uid") then return end

local root = getRootElement()
local resourceRoot = getResourceRootElement(getThisResource())
local screenWidth, screenHeight = guiGetScreenSize()


local blurStrength = 20


local myScreenSource = dxCreateScreenSource(screenWidth, screenHeight)
blurShader, blurTec = dxCreateShader("shaders/BlurShader.fx")


function renderblur()
if blur == true then
dxUpdateScreenSource(myScreenSource)

dxSetShaderValue(blurShader, "ScreenSource", myScreenSource);
dxSetShaderValue(blurShader, "BlurStrength", blurStrength);
dxSetShaderValue(blurShader, "UVSize", screenWidth, screenHeight);

dxDrawImage(0, 0, screenWidth, screenHeight, blurShader)
end
end
addEventHandler("onClientRender", root, renderblur)

addEventHandler("onClientResourceStop", resourceRoot,
function()
if (blurShader) then
destroyElement(blurShader)
blurShader = nil
end
end)

x,y=2313.58, 1282.80-- my width
intro_step=math.random(0,850)

local sx,sy=guiGetScreenSize()
local data={ showed=nil, button={}, info=nil, misc=nil, }

function isMouseIn(psx,psy,pssx,pssy,abx,aby)
if not isCursorShowing() then return end
cx,cy=getCursorPosition()
cx,cy=cx*sx,cy*sy
if cx >= psx and cx <= psx+pssx and cy >= psy and cy <= psy+pssy then
return true,cx,cy
else
return false
end
end
local dist = 100
local angler = 0
function getPointFromDistanceRotation(x, y, dist, angler)
local a = math.rad(90 - angler)
local dx = math.cos(a) * dist;
local dy = math.sin(a) * dist;
return x+dx, y+dy;
end

function renderLoginBox()
blur = true
dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(0, 0, 0, 135), false)
dxDrawRectangle(sx*270/1025, sy*150/769, sx*500/1025, sy*458/767, tocolor(0, 0, 0, 135), false)
--dxDrawImage(0, 0, 1920, 1080, "misc/drift.png", AristatesYuvarlak, 0, 0, tocolor(255, 255, 255, 255), false)
if data.info then dxDrawText(data.info, sx*252/1024, sy*272/768, sx*800/1024, sy*255/768, tocolor(237, 0, 0, 255), 1.00, "default", "center", "center", false) end
--dxDrawLine(sx*0/1024, sy*199/768, sx*1022/1024, sy*200/768, tocolor(31, 111, 193, 255), 5, false)
--dxDrawLine(sx*0/1024, sy*509/768, sx*1022/1024, sy*510/768, tocolor(31, 111, 193, 255), 5, false)
dxDrawText("U?ytkownik", sx*280/1024, sy*270/768, sx*760/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
dxDrawText("Has?o", sx*-240/1024, sy*480/768, sx*1280/1024, sy*302/768, white, 1.30, "default-bold", "center", "center", false)
if not isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false)
else dxDrawRectangle(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false) end
if not isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) then dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false)
else dxDrawRectangle(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768, tocolor(255, 0, 0, 255), false) end
dxDrawText("Zaloguj si?", sx*685/1024, sy*1015/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
dxDrawText("Zarejestruj si?", sx*1140/1024, sy*1013/768, sx*130/1024, sy*45/768, white, 1.00, "default-bold", "center", "center", false)
dxDrawImage(sx * 0.3118, sy * 0.1813, sx * 0.3838, sy * 0.1549, "logo.png", 0, 0, 0, tocolor(255, 255, 255, 255), false)
dxDrawImage(sw/2-295,sh/2+70,594,307,"logo.png", angle, 0, -120 )
local x,y=getPointFromDistanceRotation(2313.58, 1282.80, dist, angler)
setCameraMatrix(x,y,107.72+0.9,2323.69, 1285.66, 107.72+0.9)
angler=(angler+0.1)
end


addEventHandler("onClientClick", root, function(btn,state)
if btn=="left" and state=="down" then
if isMouseIn(sx*305/1024, sy*506/768, sx*200/1024, sy*45/768) and data.showed then
local login=guiGetText(data.button[1])
local pass=guiGetText(data.button[2])
if string.len(login) < 2 or string.len(pass) < 2 then
data.info="Wype?nij wszystkie pola!"
return
end
triggerServerEvent("logging:checkAccount", resourceRoot, login, pass)
end
if isMouseIn(sx*535/1024, sy*506/768, sx*200/1024, sy*45/768) and data.showed then
local login=guiGetText(data.button[1])
local pass=guiGetText(data.button[2])
if string.len(login) > 22 or string.len(pass) > 22 and string.len(login) < 3 or string.len(pass) < 3 then
data.info="Login/Has?o musz? mie? mniej ni? od 3 do 22 znak?w."
return
end
triggerServerEvent("logging:newAccount", resourceRoot, login, pass)
end
end
end)

addEvent("logging:result", true)
addEventHandler("logging:result", resourceRoot, function(value,info)
if not info then info="" end
if value then
data.showed=false
showZones(data.misc)

-- Usuwamy elementy
destroyElement(data.button[1])
destroyElement(data.button[2])
removeEventHandler("onClientRender", root, renderLoginBox)
else
data.info=tostring(info)
setTimer(function() data.info=nil end, 3000, 1)
end
end)

addEventHandler("onClientResourceStart", resourceRoot, function()
showChat(false)
showCursor(true)
fadeCamera(true)
data.showed=true
setElementAlpha(localPlayer,0)
data.misc=playSound("misc/intro.mp3",true)
setSoundVolume(data.misc, 1.0)
showPlayerHudComponent("all",false)
guiSetInputMode("no_binds_when_editing")
setElementData(localPlayer,"status","Loguje si?")
--setElementData(localPlayer,"player:logged",false)
addEventHandler("onClientRender", root, renderLoginBox)
data.button[1]=guiCreateEdit(0.40, 0.40, 0.22, 0.04, "", true)
data.button[2]=guiCreateEdit(0.40, 0.53, 0.22, 0.04, "", true)
guiEditSetMasked(data.button[2],true)
end)


Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-24, 15:24


.RiV







Wiek: 25
Na forum: 3588 dni
Posty: 554
Nick w MP: Split

Piwa: 2596

Respekt: 597,8
Respekt: 597,8

Wklejasz ten kod do swojego kodu:

function roundedRectangle(xywhborderColorbgColorpostGUI)
    if (and and and hthen
        if (not borderColorthen
            borderColor tocolor(000200);
        end
        
        if (not bgColorthen
            bgColor borderColor;
        end
        
        --- Background
        dxDrawRectangle(xywhbgColorpostGUI);
        
        --- Border
        dxDrawRectangle(2141borderColorpostGUI); -- top
        dxDrawRectangle(2h41borderColorpostGUI); -- bottom
        dxDrawRectangle(1214borderColorpostGUI); -- left
        dxDrawRectangle(w214borderColorpostGUI); -- right
    end
end


I potem zamiast dxDrawRectangle w swoim kodzie dajesz roundedRectangle :)

Podpis

Autor OGRPG, na scenie MTA od 2012 roku.




Użytkownik: 08.08.2016
GTAO Member: 06.02.2017
Support-Team: 17.06.2017 & 01.06.2019 - 18.11.2019
Moderator: 14.01.2018 - 09.08.2018

Postaw piwo autorowi tego posta
 

 
Wysłany: 2017-12-24, 16:21


luki123luki123

Place Game






Wiek: 28
Na forum: 5275 dni
Posty: 1948
Nick w MP: LuKiO

Piwa: 6101

Respekt: 611
Respekt: 611Respekt: 611

Daybreak,
function dxCreateRoundedTexture(text_width,text_height,radius)
    assert(text_width,"Missing argument 'text_width' at dxCreateRoundedTexture")
    assert(text_height,"Missing argument 'height' at dxCreateRoundedTexture")
    assert(radius,"Missing argument 'radius' at dxCreateRoundedTexture")
    if type(text_width) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 1, got " .. type(text_width) .. "]",2) return false end
    if type(text_height) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 2, got " .. type(text_height) .. "]",2) return false end
    if type(radius) ~= "number" then outputDebugString("Bad argument @ 'dxCreateRoundedTexture' [Excepted number at argument 3, got " .. type(radius) .. "]",2) return false end
    if text_width 0 then outputDebugString("text_width can't be less than 0",1) return false end
    if text_height 0 then outputDebugString("text_height can't be less than 0",1) return false end
    if radius or radius 100 then outputDebugString("Parameter 'radius' can't be between 0 and 100",1) return false end

    local texture DxTexture(text_width,text_height)
    local pix texture:getPixels()

    radius = (radius * (text_height 2)) / 100

    for x=0,text_width do
        for y=0,text_height do
            if >= radius and <= text_width radius then
                dxSetPixelColor(pix,x,y,255,255,255,255)
            end
            if >= radius and <= text_height radius then
                dxSetPixelColor(pix,x,y,255,255,255,255)
            end
            if math.sqrt((radius)^+ (radius)^2) < radius then
                dxSetPixelColor(pix,x,y,255,255,255,255) -- lewy gorny rog
            end
            if math.sqrt((- (text_width radius))^+ (radius)^2) < radius then
                dxSetPixelColor(pix,x,y,255,255,255,255) -- prawy gorny rog
            end
            if math.sqrt((radius)^+ (- (text_height radius))^2) < radius then
                dxSetPixelColor(pix,x,y,255,255,255,255) -- lewy dolny rog
            end
            if math.sqrt((- (text_width radius))^+ (- (text_height radius))^2) < radius then
                dxSetPixelColor(pix,x,y,255,255,255,255) -- prawy dolny rog
            end
        end
    end
    texture:setPixels(pix)
    return texture
end

local texutra dxCreateRoundedTexture40030020 )

addEventHandler("onClientRender",root,
function()
  if texutra then
    local screenWidthscreenHeight guiGetScreenSize()
    dxDrawImage screenWidth-400)/2, (screenHeight -300)/2400300texture )
end)


Postaw piwo autorowi tego posta
 

 
Tagi: zaokrąglenie :: dxdrawrectangle
Anonymous





Na forum: 245 dni
Posty: 1



Anonymous Koniecznie zajrzyj na:






Skocz do:  
Wyświetl posty z ostatnich:   
GTAONLINE.PL » JĘZYKI PROGRAMOWANIA » LUA Ten temat jest zablokowany bez możliwości zmiany postów lub pisania odpowiedzi

Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
Dodaj temat do Ulubionych
Wersja do druku