Maurize Posted January 20, 2012 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?
Castillo Posted January 20, 2012 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 San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted January 20, 2012 Posted January 20, 2012 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
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