tommymaster

dx GUI

Recommended Posts

Hi! I photoshopped a nice flat-looking login panel, but i only know how to attach click events to a button or stuff like buttons, but for example how should i make a script, that notifies me whenever i click on a button, that is right at the middle of the screen, and it's height is 100 and length is also 100?

Edited by tommymaster

Share this post


Link to post

1. use the onClientClick event to detect mouse clicks (check the wiki)

2. within that event you can check for the mouse position (arg 3 and 4) or you can get it yourself with getCursorPosition() and multiplying the x and y by the your screen size (guiGetScreenSize)

3. check if the position is within your button's dimensions (mx > x and mx < x + w and my > y and my < y + h)

Share this post


Link to post

can i do it like i add a gui button, and make it transparent somehow, and after it i insert my image to it's place?

Share this post


Link to post

You can create a gui behind your "dx button" and set it is alpha to 0. Or you could just use guiCreateStaticImage

  • Sad 1

Share this post


Link to post
18 hours ago, ALw7sH said:

You can create a gui behind your "dx button" and set it is alpha to 0. Or you could just use guiCreateStaticImage

i was thinking about making a function for it, but then realised that i can't make click events for it, and cant destroy it anyhow, and use them as elemenets. I will take a look at dxlib if i can't work this out thanks for the suggestion.

  • Like 1

Share this post


Link to post

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.