.:HyPeX:. Posted March 27, 2014 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) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Moderators IIYAMA Posted March 28, 2014 Moderators 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] 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
.:HyPeX:. Posted March 28, 2014 Author 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()) My ingame nick is ~HyPeX~ BF3 Gamemode Progress: ~30% - Currently working on AI & MapManager
Moderators IIYAMA Posted March 28, 2014 Moderators Posted March 28, 2014 oh lol I haven't seen that too. 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
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