Maurize Posted January 20, 2012 Share Posted January 20, 2012 addEventHandler( "onClientRender", getRootElement(), function() if ( isCursorShowing() == true ) then local sx, sy, wx, wy, wz = getCursorPosition" class="kw4">getCursorPosition() dxDrawImage( sx, sy, 55, 75, "mainFiles/elementCursor.png" ) end end ) Doen't work. Image is in the top-left corner... Anything wrong? Link to comment
Castillo Posted January 20, 2012 Share Posted January 20, 2012 It returns a relative values, but you need absolute values for dxDrawImage. addEventHandler( "onClientRender", getRootElement(), function() if ( isCursorShowing() == true ) then local sx, sy, wx, wy, wz = getCursorPosition() local sx, sy = relativeToAbsolute(sx, sy) dxDrawImage( sx, sy, 55, 75, "mainFiles/elementCursor.png" ) end end ) function relativeToAbsolute( X, Y ) local rX, rY = guiGetScreenSize() local x = X*rX local y = Y*rY return x, y end Link to comment
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