![]() |
|
Release GUI Lib - Printable Version +- Team Spartan Cookies & Milk Forums (https://teamscm.co.uk) +-- Forum: Garry's Mod (https://teamscm.co.uk/forum-4.html) +--- Forum: Starfall (https://teamscm.co.uk/forum-7.html) +--- Thread: Release GUI Lib (/thread-1433.html) |
GUI Lib - SuperPlayer - 28-10-2015 Hello everyone, Welcome to the GUI lib. The gui lib allowes you to create windows. You can move windows arround your whole starfall screen and make them any size you want. The window which was used the last will always be rendered on top of the other windows. This manuel will just cover how the GUI lib works. The GUI lib has almost every function which is needed to draw on a screen. You need to use the gui function to make it work. The objects you draw on your windows will NOT be drawn over the size of the window. The position coordinates are based on the size of the window they are put on. So a window with size 100x100 will have a coordinates set from 100x100. The red button on the right top on the windows makes them close. To re-enable them or close them through other code instances do:
To move a window press use on the grey bar and then move your mouse. Press use a gain to stop moving the window.Ok lets start: Please not that parent should always be 'p' or the name of the window the object should belong to. This is VERY important for the lib to work. The functions are working like the normal starfall functions. 1.) Creating a window
Name = The name your window should have Shown is either true or false. It determains whether the window should be drawn or not. Usefull if you want to create some sort of OS. x and y are the coordinates where your window should appear first w and h are representing the size of the window Color is the color the window should have. Ex. Color(120,120,120,200) wil create a window with a grey color where you can look through In the function you put everything of the following elements. 2.) Making a button
index is the name you want to give the button. Dont use a button twicex and y are the coordinates where your button should be w and h are representing the size of the button Parent is the string name of the window the button should belong to func is the function which you want to call when the button is pressed The function also passes the player who pressed the button Example:
3.) Drawing a rectangle
x and y are the coordinates where your rectangle should be on the window. Use the window size as orientation. So if your window has the size 100 x 100 you can use the coordinates from 0 to 100 for x and yw and h are representing the size of the rectangle. Please note that rectangles dont draw beyond the size of the window Color is the color the button should have. Parent is the string name of the window the rectangle should belong to 4.) Drawing an outlined rectangle
x and y are the coordinates where your rectangle should be on the window. Use the window size as orientation. So if your window has the size 100 x 100 you can use the coordinates from 0 to 100 for x and yw and h are representing the size of the rectangle. Please note that rectangles dont draw beyond the size of the window Color is the color the button should have. Parent is the string name of the window the rectangle should belong to 5.) Drawing a textured rectangle
x and y are the coordinates where your rectangle should be on the window. Use the window size as orientation. So if your window has the size 100 x 100 you can use the coordinates from 0 to 100 for x and yw and h are representing the size of the rectangle. Please note that rectangles dont draw beyond the size of the window Color is the color the button should have. Parent is the string name of the window the rectangle should belong to 6.) Drawing a normal circle
x and y are the coordinates where your circle should be on the window. Use the window size as orientation. So if your window has the size 100 x 100 you can use the coordinates from 0 to 100 for x and yw and h are representing the size of the circle. Please note that circles dont draw beyond the size of the window Color is the color the button should have. Parent is the string name of the window the circle should belong to 7.) Drawing a filled circle
x and y are the coordinates where your circle should be on the window. Use the window size as orientation. So if your window has the size 100 x 100 you can use the coordinates from 0 to 100 for x and yw and h are representing the size of the circle. Please note that circles dont draw beyond the size of the window Color is the color the button should have. Parent is the string name of the window the circle should belong to 8.) Drawing a line
x1 and y1 are the start coordinatesx2 and y2 are the end coordinates Color is the color the line should have. Parent is the string name of the window the line should belong to 9.) Drawing a poly
Table is a table of the coordinates your poly should drawColor is the color the poly should have. Parent is the string name of the window the poly should belong to Example :
10.) Writing text
font is the font the should havex and y are the coordinates text is the string text alignment is the alignment used in the normal drawText Parent is the string name of the window the text should belong to For a better understanding please look through the code of the GUILib_Example. Lets hope i didnt forget anything ![]() If you have any function request or questions feel free to contact me. You can download the lib here and put the files into : "C:\Program Files (x86)\Steam\SteamApps\common\GarrysMod\garrysmod\data\starfall\lib\gui" ( Every file except for the example) or you can download the gui lib and the example from my shared folder. lib/gui -> download package for the lib and GUILib_Example for the example script. Use to include the lib in your scripts.I hope you enjoy this lib. SuperPlayer RE: GUI Lib - Destiny's Player - 28-10-2015 Welp, welcome to the future, guys, we're here. Anyway, I remember seeing your windows, and they're pretty darn amazing. Hope that you and other people create some amazing stuff with this stuff. RE: GUI Lib - TheOneAndOnlyTee - 28-10-2015 Do these functions use parameters like LocInts functions or normal render.drawRect() RE: GUI Lib - SuperPlayer - 29-10-2015 (28-10-2015, 10:04 PM)Destinys Player Wrote: Welp, welcome to the future, guys, we're here.Actually I am working on a project which is uses the lib. Its still very early but there will probably be something coming sooner or later. ![]() T-17 Wrote:Do these functions use parameters like LocInts functions or normal render.drawRect()They use the normal parameters, just like the standard starfall stuff. I added it also to the discription. RE: GUI Lib - TheOneAndOnlyTee - 29-10-2015 you forgot to include the Shown parameter in GUI.createWindow() example EDIT: also what's the Func parameter for GUI.createWindow() do? EDIT2:
Using that code i can't seem to see the Close button or Frame and I also can't move it around.EDIT3: facepalm, didn't read the example and now i know where i went wrong RE: GUI Lib - SuperPlayer - 29-10-2015 (29-10-2015, 01:51 AM)T-17 Wrote: you forgot to include the Shown parameter in GUI.createWindow() exampleAhh damn. That was the old code. I am going to adjust the example:
RE: GUI Lib - TheOneAndOnlyTee - 29-10-2015 Noticed that for your close button function that you use 'GUI.Frames[string.sub(i,7,999)]' to determine the frame to close, you can merely use GUI.Frames[string.sub(i,7)] because leaving the 999 out tells string.sub() goto the end of the string. EDIT: just added a minimise button and change the move window button width to w/2, if you want to see it i'll chuck the changes into a file for you RE: GUI Lib - SuperPlayer - 29-10-2015 Sure! Maybe i will implement something of it into the lib. |