Jump to content

Background image


RandomRambo

Recommended Posts

Posted (edited)

Hi guys.
Need some help with DX , I have some code and I need to put an image in the background of this window.

Tryed 

guiCreateStaticImage  

But it doesn't work correctly or doesn't work at all ?

I know that here is dxDrawRectangle but I need instead of this black "window" a transparent image behind this window.


Help if u know how to do it.
Code:

function Render()
	if getElementData(localPlayer,"inMenu") == true then
		destroyWorkWindow()
	end
dxDrawRectangle(x-450, y-292, 900, 400, tocolor ( 0, 0, 0, 210) )
dxDrawRectangle(x-410, y-242, 350, 320, tocolor ( 255, 255, 255, 80) )
twd = dxGetTextWidth(getElementData(isReal(),"name"), 1.3, "default-bold")
dxDrawText(getElementData(isReal(),"name"),x-245-twd/2, y-272, 350, 500,tocolor (181,166,66, 255 ), 1.3, "default-bold")
	start = -10
        for i, v in ipairs(works) do
		if i == qtLabelEntered and qtLabelSelected ~= i then
			dxDrawRectangle(x-410, y-232+start, 350, 35, tocolor ( 180, 180, 180, 210) )
		elseif i == qLabelSelected then
			dxDrawRectangle(x-410, y-232+start, 350, 35, tocolor ( 181,166,66, 210) )
			if qtAcceptEntered == 1 then
				dxDrawRectangle(x+10,y+28,400,50, tocolor( 181,166,66, 80))
			else
				dxDrawRectangle(x+10,y+28,400,50, tocolor( 255, 255, 255, 80))
			end
			local checkWork = getElementData(localPlayer,"works") or 0
			if checkWork == v.works then
				twd = dxGetTextWidth("Accept",1.3,"default-bold")
				dxDrawText("Accept",x+210-twd/2,y+43,400,50,tocolor ( 255,255,255, 255 ), 1.3, "default-bold")
			else
				twd = dxGetTextWidth("Go",1.3,"default-bold")
				dxDrawText("Go",x+210-twd/2,y+43,400,50,tocolor ( 255,255,255, 255 ), 1.3, "default-bold")
			end
		end
		if getElementData(isReal(),"id") == v.works then
                                twd = dxGetTextWidth(v.name,1.3,"default-bold")
                                dxDrawText(v.name,x-245-twd/2, y-232+start+5, 350, 500,tocolor ( 255,255,255, 255 ), 1.3, "default-bold")
                                start = start + 35
				end
	end
end

 

Edited by RandomRambo
Posted

Hello RandomRambo,

have you tried using dxDrawImage with a transparent alpha value for color? You can load an image using dxCreateTexture at load-time of your resource and use the texture handle in a dxDrawImage call. This will allow you to draw the background image transparent instead of simple rectangles.

Not using dxCreateTexture is not recommended.

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