• Making Geometrical forms
    5 replies, posted
[B]Hi,[/B] I have been trying to make some forms to huds, and just to learn how I can make them and I been trying to make this forms: [IMG]http://i.imgur.com/76ykq8O.png[/IMG] [IMG]http://i.imgur.com/t1g8eq7.png[/IMG] [IMG]http://i.imgur.com/tFNybo9.png[/IMG] Can someone tell me how I can make them ? ( I know I need to use DrawPoly but I really cant understand how to do it ) Question 2 : What is the size of a gmod screen ( X = ???? Y = ????/Height = ????? Width = ???? ) If I get the X and Y/Height and Width of the Gmod Screen I could try to make a template to know the X and Y and would be probably easier to make rectangles and other forms.
GMod renders from top left corner down to the lower right corner. So: You can get the screen resolution by calling ScrW() to get width, and ScrH() to get height. [code] x = 0 y = 0 Width = ScrW() Height = ScrH() [/code] Here's an example from the wiki, so I don't understand what it is you don't understand. [URL]http://wiki.garrysmod.com/page/surface/DrawPoly[/URL] [URL]http://wiki.garrysmod.com/page/Structures/PolygonVertex[/URL] surface.DrawPoly takes a table of vertices, for example: [code] surface.DrawPoly( { -- Triangle covering the upper half diagonal side of the screen. { x = 0, y = 0 }, { x = ScrW(), y = 0 }, { x = 0, y = ScrH() } } ) [/code]
[QUOTE=McDunkable;49882329]GMod renders from top left corner down to the lower right corner. So: You can get the screen resolution by calling ScrW() to get width, and ScrH() to get height. [code] x = 0 y = 0 Width = ScrW() Height = ScrH() [/code] Here's an example from the wiki, so I don't understand what it is you don't understand. [URL]http://wiki.garrysmod.com/page/surface/DrawPoly[/URL] [URL]http://wiki.garrysmod.com/page/Structures/PolygonVertex[/URL] surface.DrawPoly takes a table of vertices, for example: [code] surface.DrawPoly( { -- Triangle covering the upper half diagonal side of the screen. { x = 0, y = 0 }, { x = ScrW(), y = 0 }, { x = 0, y = ScrH() } } ) [/code][/QUOTE] But How would I get the ScrW and the ScrH in numbers ??
ScrW() and ScrH() already return a number, the width, and height, respectively. Here's an image that should help you visualize the polygon. [t]https://i.gyazo.com/c5b7442ccaab3485973e094f58fd8294.png[/t]
[QUOTE=McDunkable;49882355]ScrW() and ScrH() already return a number, the width, and height, respectively. Here's an image that should help you visualize the polygon. [t]https://i.gyazo.com/c5b7442ccaab3485973e094f58fd8294.png[/t][/QUOTE] I wanted to know the ScrW and ScrH in numbers so I could make something like this [IMG]http://i.imgur.com/AX3idy8.jpg[/IMG] So when I am making something that needs X and Y would be easier to find out
You may want to learn programming some programming basics firsts. ScrW() is a function that returns the client's screen resolution width. Instead of using constants, use ScrW() and ScrH() respectively so that HUD positioning / dimensions are dynamic. If you want to know ScrW() and ScrH(), simply print them onto the conolse, but again. Don't use "magic numbers". [url]http://www.lua.org/pil/5.html[/url]
Sorry, you need to Log In to post a reply to this thread.