Jump to content

[HELP]dxDrawImage


boban88

Recommended Posts

Hello i have this client side script but not working and i have not idea why. Please try help me.

local sW,sH = guiGetScreenSize ( ); 
local gUtils = { }; 
gUtils.guiW,gUtils.guiH = 398, 410; 
gUtils.posX,gUtils.posY = sW / 2 - gUtils.guiW / 2, sH / 2 - gUtils.guiH / 2;  
local gLabels = { }; 
local gButtons = { }; 
  
function createGui ( ) 
    gWindow = dxDrawImage(gUtils.posX, gUtils.posY, 300, 300, 'images/up.png') 
    guiWindowSetSizable ( gWindow, false ); 
    guiSetVisible ( gWindow, false ); 
    bindKey ( "F10", "down", showPanel ); 
end 
addEventHandler ( "onClientResourceStart", getResourceRootElement ( getThisResource ( ) ), createGui ) 
  
function showPanel ( ) 
    if guiGetVisible ( gWindow ) then 
        guiSetVisible ( gWindow, false ); 
        showCursor ( false ); 
    else 
        guiSetVisible ( gWindow, true ); 
        showCursor ( true ); 
    end 
end 

no errors no warnings if i change image for guiCreateWindow then script working and show me GUI but image no. Thx for all replies.

Link to comment

Edit #

local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
  
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') 
end 
  
bindKey("F10","down",function () 
    if removeEventHandler("onClientRender",root,createDx) then 
    removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
    addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
end 

Edited by Guest
Link to comment
Edit #
local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
  
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') 
end 
  
bindKey("F10","down",function () 
    if removeEventHandler("onClientRender",root,createDx) 
    removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
    addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
end 

lines 9~10, you remove the event and then remove it again, what? (also you forget the then).

local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
local rendering 
     
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') 
end 
     
bindKey("F10","down",function () 
    if rendering then 
        removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
        addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
    rendering = not rendering 
end 

Link to comment
Edit #
local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
  
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') 
end 
  
bindKey("F10","down",function () 
    if removeEventHandler("onClientRender",root,createDx) 
    removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
    addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
end 

lines 9~10, you remove the event and then remove it again, what? (also you forget the then).

local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
local rendering 
     
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'images/up.png') 
end 
     
bindKey("F10","down",function () 
    if rendering then 
        removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
        addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
    rendering = not rendering 
end 

It did not change anything ,

This style of programming in my own way in the Crown programming ,

I forgot 'then' only ,

Link to comment
stiil nothing but now cursor dont show too :/
local x, y = guiGetScreenSize() 
local rx, ry = (x/1400), (y/900) 
local rendering 
    
function createDx ( ) 
    dxDrawImage(rx*398, ry*410, rx*300, ry*300, 'up.png') 
end 
    
bindKey("F10","down",function () 
    if rendering then 
        removeEventHandler("onClientRender",root,createDx) 
        showCursor ( false ) 
    else 
        addEventHandler("onClientRender",root,createDx) 
        showCursor ( true ) 
    end 
    rendering = not rendering 
end ) 

i just forgot an ) ...

Link to comment
  • 2 weeks later...

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