.:HyPeX:. Posted March 27, 2014 Share Posted March 27, 2014 Hey guys, i'm trying to create a compass, how could i update the image on every frame? it draws it up on the pixels 400-500 always.. idk why. function dxDrawImageX() local rotz = getElementRotation(getLocalPlayer()) local now = rotz local End = 360 local progress = now / End local DrawX = interpolateBetween(0,0,0,400, 0,0,progress, "Linear") image = dxDrawImageSection(65, 516,165, 50, DrawX, 0, 100, 50, "360.png") end addEventHandler("onClientRender", getRootElement(), dxDrawImageX) Help pls. Image: http://imgur.com/wlCwvyO PD: Image size is 500x50 (0-400, 400-500 is a replica of 0-100) Link to comment
WhoAmI Posted March 28, 2014 Share Posted March 28, 2014 You are updating it by using onClientRender. Link to comment
Moderators IIYAMA Posted March 28, 2014 Moderators Share Posted March 28, 2014 function dxDrawImageX() local rotz = getElementRotation(getLocalPlayer()) local now = rotz local End = 360 local progress = now / End dxDrawImageSection(65+(progress*250),516,500, 50, 65, 0, 100, 50, "360.png") end addEventHandler("onClientRender", getRootElement(), dxDrawImageX) As you said image is 500x 50 and not 165x50 which you did. Does the image move or what? And at what value does the image starts? Is the 0 in the middle? You have to see dxImageSection as a photoshop masker(except it isn't moving with the image). Between those arguments the image is visible: [b]u:[/b] the absolute X coordinate of the top left corner of the section which should be drawn from image [b]v:[/b] the absolute Y coordinate of the top left corner of the section which should be drawn from image [b]usize:[/b] the absolute width of the image section [b]vsize:[/b] the absolute height of the image section My screen is 1920x1080. And I want to show an image on my screen which has a non pixel border(50 px). Then I would use those values: posX = [color=#FF8000]0[/color] posY = [color=#FF8000]0[/color] width =[color=#FF8000] 1920[/color] height =[color=#FF8000] 1080[/color] u =[color=#FF8000] 50[/color] v =[color=#FF8000] 50[/color] usize = [color=#FF8000]1870[/color][color=#00FF00] -- 1920-50[/color] vsize = [color=#FF8000]1030[/color] [color=#00FF00]-- 1080-50[/color] Link to comment
.:HyPeX:. Posted March 28, 2014 Author Share Posted March 28, 2014 That stuff is bad, no offense, but it is 100 pixels, as it goes from 65 - 165 (165 - 65 = 100), and it works just fine. Anyways, found out it was this: local rotx, roty, rotz = getElementRotation(getLocalPlayer()) Link to comment
Moderators IIYAMA Posted March 28, 2014 Moderators Share Posted March 28, 2014 oh lol I haven't seen that too. 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