kikos500 Posted September 12, 2015 Share Posted September 12, 2015 Well today I wanted to start to make a userpanel with dx so I wanted to make the panel appear in the same postion on all resolutions I know that I need to use guiGetScreenSize() but idk how to make the calculation after it I mean I want to create a panel using an image and make it open with animation I hope someone can understand me Link to comment
LabiVila Posted September 12, 2015 Share Posted September 12, 2015 Well, you would want not to use draw images, you can just manipulate with rectangles. As for screen size, dxDrawRectangle (400, 400, 200, 200, tocolor (255, 255, 255)) applying screen size would look like this: dxDrawRectangle (400/800*x, 400/600*y, 200/800*x, 200/600*y, tocolor (255, 255, 255)) this would only work if your coordinates are 800 x 600, and making sure you have defined x,y as screen size. And as for animations, you can use interpolateBetween, best solution I know Link to comment
kikos500 Posted September 12, 2015 Author Share Posted September 12, 2015 Well, you would want not to use draw images, you can just manipulate with rectangles. As for screen size, dxDrawRectangle (400, 400, 200, 200, tocolor (255, 255, 255)) applying screen size would look like this: dxDrawRectangle (400/800*x, 400/600*y, 200/800*x, 200/600*y, tocolor (255, 255, 255)) this would only work if your coordinates are 800 x 600, and making sure you have defined x,y as screen size. And as for animations, you can use interpolateBetween, best solution I know Thanks at least I understand how to do it now Would be nice if someone can provide an example with dxDraaImage too Link to comment
LabiVila Posted September 12, 2015 Share Posted September 12, 2015 I would not suggest you to use dxDrawImage, it'd be better if you use rectangles, it's almost the same believe me, especially for an UP. Link to comment
AlvarO Posted September 13, 2015 Share Posted September 13, 2015 --To make the panel appear in the same postion on all resolutions local sx, sy = guiGetScreenSize() local px, py = 1980, 1080 --This is the scripter resolution, in my case mine is the one in left local x, y = (sx/py), (sy/py) --Animations --Using variables animation = 0 function animationsForDX() animation = animation + 1 dxDrawRectangle(x/2, y/2, animation, y, tocolor(0,0,0,200)) end addEventHandler("onClientRender", root, animationsForDX) --Or using interpolateBetween function animationsForDX() local x, y = interpolateBetween ( dx, dy, dx+4, dy+4, 1500, "Linear") dxDrawRectangle(x/2, y/2, dx, dy, tocolor(0,0,0,200)) end addEventHandler("onClientRender", root, animationsForDX) Hope I helped you! 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