Dice Posted March 3, 2013 Posted March 3, 2013 Hello again, I am currently using an image as a template and I am curious how to make a image movable, pretty much treat it like if it were a window.
golanu21 Posted March 3, 2013 Posted March 3, 2013 With dx functions [Dev]BloWnRPG - We BloW the World [1%]
Jaysds1 Posted March 3, 2013 Posted March 3, 2013 just use this function: guiSetPosition--moves the image getCursorPosition --gets the cursor position My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
Tete omar Posted March 4, 2013 Posted March 4, 2013 just use this function: guiSetPosition--moves the image getCursorPosition --gets the cursor position He'll also need these events onClientGUIClick and onClientRender
Dice Posted March 4, 2013 Author Posted March 4, 2013 I can't move it around like a window becuase it says the down STATE is not working
Castillo Posted March 4, 2013 Posted March 4, 2013 What about this event? https://wiki.multitheftauto.com/wiki/On ... IMouseDown It even has an example related to what you are doing, with this and some basic maths, you can turn your image into something like a window. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Dice Posted March 4, 2013 Author Posted March 4, 2013 addEventHandler ( "onClientGUIMouseDown", root, dragDown ) -- < that is embedded within onClientResourceStart because that is where GUI variables are function dragDown ( button, x, y ) if button == "left" then if source == main then outputChatBox ( "124" ) wX, wY = guiGetPosition ( maun, false ) z = x - wX s = y - wY addEventHandler ( "onClientCursorMove", root, function(_,_,a,b) if ftamainp then guiSetPosition ( main, a - z, b - s, false ) end end ) end end end It works, but I can't figure out how to remove the onClientCursorMove when onClientGUIMouseUp
Moderators IIYAMA Posted March 4, 2013 Moderators Posted March 4, 2013 https://wiki.multitheftauto.com/wiki/RemoveEventHandler Do you want to improve your Lua programming skills and make less mistakes? Start with Lua Language Server! Useful functions 3x Spoiler checkPassiveTimer getScreenStartPositionFromBox getPedGender Tutorials 4x Spoiler Scaling DX Events Attach an addEventHandler on a group of elements Debugging
Dice Posted March 4, 2013 Author Posted March 4, 2013 @ IIYAMA You can't do that when the function is embedded....but thanks you gave me another idea. Snake I didn't even know that function existed so thanks lol. figured it out.
Castillo Posted March 4, 2013 Posted March 4, 2013 Is an event, not a function. 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