Jump to content

Help


Xeno

Recommended Posts

local screenWidth, screenHeight = guiGetScreenSize() 
  
function news(clickedElement) 
cx,cy = getCursorPosition() 
if cx >= 050 and cx <= 530 and cy >= screenWidth and screenHeight <= endY then 
addEventHandler("onClientRender",rootElement, serverBoxDesign) 
end 
end 
addEventHandler ( "onClientClick", getRootElement(), news ) 

Would something like this work? I'm trying to make a dxDraw clickable.

What I don't understand is how i'm meant to get the parts of the screen??

Thanks

Xeno

Link to comment

simplest way to provide click (and other) events for dx stuff is to create underlying gui-element with the same size/position and 0 opacity, and catch the events from it.

other (proper?) way is screen click detection, but you'll have to script everything yourself.

basically in onClick event you check if the coordinates of the click are within the bounding box of your dxDraw.

which is what you're doing here (as it seems, though i dont know what endY is).

Link to comment
The example I used is from a friend.

Could I say, make a gui element like a label, and make the size's as big at the dx draw? Wouldn't it go behind the dxDraw and be un-clickalbe?

whatever the rendering mode is, dx stuff is "click-through".

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