Matevsz Posted April 4 Share Posted April 4 Hi, I'm trying to make a speedometer created in GUIEditor, but I can't make the needle move. I saw that many speedometers are made with dxDrawRelativeImage and how to do it with GUIEditor? GUIEditor.staticimage[8] = guiCreateStaticImage(1159 * scaleX, 741 * scaleY, 257 * scaleX, 244 * scaleY, "Speedo/ASDDIAL.png", false) GUIEditor.staticimage[9] = guiCreateStaticImage(21 * scaleX, 10 * scaleY, 216 * scaleX, 246 * scaleY, "Speedo/DALTLONG.png", false, GUIEditor.staticimage[8]) local function drawSpeedo() local veh = getPedOccupiedVehicle(localPlayer) if not veh then return end local velx, vely, velz = getElementVelocity(veh) local speed = (velx ^ 2 + vely ^ 2 + velz ^ 2) ^ (0.5) needleRotation = -146 + (speed * 180) end local isSpeedoShown = false function toggleRender(bool) if bool then isSpeedoShown = true addEventHandler("onClientRender", root, drawSpeedo) addEventHandler("onClientRender", root, rotateNeedle) else isSpeedoShown = false removeEventHandler("onClientRender", root, drawSpeedo) removeEventHandler("onClientRender", root, rotateNeedle) end end function rotateNeedle() local needleImage = GUIEditor.staticimage[9] guiSetProperty(needleImage, "Rotated", tostring(needleRotation)) end Link to comment
FileEX Posted April 5 Share Posted April 5 There is no property called "Rotated" in CEGUI. The properties related to rotation are: "Rotation" or "XRotation", "YRotation", "ZRotation". Try using one of them http://static.cegui.org.uk/static/WindowsLookProperties.html#StaticImage 1 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