bradio10 Posted January 18, 2015 Share Posted January 18, 2015 Hi, I am trying to make a window appear when I right click on the screen at the position of the cursor. When I right click, it always gets created at the top left corner of the screen every time. No errors in the debug Code: function drawSomethingAtCursor() local x, y = getCursorPosition() guiCreateWindow(x, y, 50, 50, "Yes?", false) end bindKey("mouse2", "down", drawSomethingAtCursor) Link to comment
Et-win Posted January 18, 2015 Share Posted January 18, 2015 'getCursorPosition' returns a value between 0 and 1. Do some math to make it absolute in pixels. Link to comment
bradio10 Posted January 18, 2015 Author Share Posted January 18, 2015 'getCursorPosition' returns a value between 0 and 1. Do some math to make it absolute in pixels. ok thanks. I was able to fix the issue and it works fine now. If anybody is wondering, I multiplied the x, y with guiGetScreenSize here is my end code result: local sX, sY = guiGetScreenSize() function drawSomethingAtCursor() local x, y = getCursorPosition() newX, newY = x * sX, y * sY win = guiCreateWindow(newX, newY, 50, 50, "Yes?", false) end bindKey("mouse2", "down", drawSomethingAtCursor) 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