• Darkrp HUD Help #2
    5 replies, posted
[url]http://pastebin.com/QZzyjwZK[/url] If you see all those positions for the hud ScrW and ScrH, the hud shows up on the bottom left of my screen. But I want it to set in the same place for all resolutions. How. -garrysmod983
I'm probably wrong here but I'll give it a shot. ScrH() and ScrW() return the Height and Width of the gmod window already. It's already in the same place for all resolutions. If you want to change the positioning of it however, you'll have to play around with that. ScrW() starts from the right, ScrH starts at the bottom. ScrW() - 100 will be 100pixels from the right ScrH() - 100 will be 100 pixels from the bottom
[QUOTE=fappymcfap;51532169]I'm probably wrong here but I'll give it a shot. ScrH() and ScrW() return the Height and Width of the gmod window already. It's already in the same place for all resolutions. If you want to change the positioning of it however, you'll have to play around with that. ScrW() starts from the right, ScrH starts at the bottom. ScrW() - 100 will be 100pixels from the right ScrH() - 100 will be 100 pixels from the bottom[/QUOTE] What he said
[QUOTE=fappymcfap;51532169]I'm probably wrong here but I'll give it a shot. ScrH() and ScrW() return the Height and Width of the gmod window already. It's already in the same place for all resolutions. If you want to change the positioning of it however, you'll have to play around with that. ScrW() starts from the right, ScrH starts at the bottom. ScrW() - 100 will be 100pixels from the right ScrH() - 100 will be 100 pixels from the bottom[/QUOTE] I understand but it only shows up there on my resolution other people have different resolutions and it shows up somewhere else.
[QUOTE=garrysmod983;51536001]I understand but it only shows up there on my resolution other people have different resolutions and it shows up somewhere else.[/QUOTE] if you do it like that it should only show up in the bottom left corner, but the size will be relatively different (actually the exact same but on different resolutions it looks smaller/larger) edit: what the fuck is this why are you setting x to scrw - 1200 or some shit when you can just set it to 100 or 200 or whatever scrw - 1200 is on your client
This might be helpful, as it was to me. [QUOTE=Author.;46653135][lua]local myscrw, myscrh = 1280, 600 function SizeW(width) local screenwidth = myscrw return width*ScrW()/screenwidth end function SizeH(height) local screenheight = myscrh return height*ScrH()/screenheight end function SizeWH(width, height) local screenwidth = myscrw local screenheight = myscrh return width*ScrW()/screenwidth, height*ScrH()/screenheight end[/lua] I always find it hard to use maths to make huds, so I just have this laying at the side. Basically it takes you're screen width and height (modify at the top), then it does some maths and returns an amount of pixels depending on the screen size of all other players, and modifies the sizes to fit like it fit your screen size. Example; [lua]surface.DrawRect(SizeW(100), SizeH(100), SizeW(200), SizeH(300))[/lua] [editline]n[/editline] A simple function to draw rectangle materials..? [lua]function DrawTexturedRect(x,y,w,h,mat) local mat = Material(mat) surface.SetMaterial(mat) surface.SetDrawColor(255,255,255) surface.DrawTexturedRect(x,y,w,h) end[/lua][/QUOTE]
Sorry, you need to Log In to post a reply to this thread.