Jump to content

Transparency with dxDrawImage


Recommended Posts

Hi guys, I want to make a transparency with an image.

I've tested to change the color parameter but it doesn't work, if anyone can help me :P

look my code:

  
        local transp = math.floor( ( ( (getTickCount()-founduTick)/ 1000 ) * 100 ) * ( 255 / 100 )  )  *256^3 + 0xffffff 
        --outputChatBox ( "Image transp "..tostring( transp ) ) 
        dxDrawImage( 0, 0, 960, 540,  "./ressources/gfx/hud.bmp",  
        0, 0, 0, transp ) 

Link to comment

Yes I know but I don't to make the image totally transpent, but I want to do a progressive transparancy.

But When I do

function HUD_onClientRender(  ) 
  
    if( showHealthArmour ) then 
        if( getTickCount()-TickCount <= 3000 ) then 
            -- la on affiche ces putains d'images  
        dxDrawImage ( 0, 0, 960, 540, "./ressources/gfx/hud.bmp" ) 
        elseif( getTickCount()-TickCount >= 4000 ) then 
            showHealthArmour = false 
            founduTick = nil 
        else 
            if( founduTick == nil ) then 
                founduTick = getTickCount( ) 
            end 
        -- Ici on fais notre fondu 
         
        local transp = math.floor( ( 255 - ( ( (getTickCount()-founduTick)/ 1000 ) * 100 ) * ( 255 / 100 )  ) )  *256^3 + 0xffffff 
     
        dxDrawImage( 0, 0, 960, 540,  "./ressources/gfx/hud.bmp", 0, 0, 0, transp )--transp ) 
        end 
    end 
  
end 
addEventHandler ( "onClientRender", getRootElement( ), HUD_onClientRender ) 

the transparency work, but the color of the image change :S

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