• Widgets - Scalable, Moveable, Resizing HUD elements
    10 replies, posted
A widgets system, these can be resized and moved by the end user. [QUOTE]Features: - Parenting, Parent one element to another using the parts system, and then choose their relationship. It makes it very easy to center things. - Scaling The parenting makes it so the objects always maintain a relationship spacing-wise. You won't have overlaps if you do widgets properly! This also allows you to decide how large you want it to be. - Resizing The elements resize to the user's resolution. You never have to fuck with resizing for the user. [/QUOTE] [IMG]http://s3.garrysmod.org/img/dl/76249_1.jpg[/IMG] [IMG]http://s3.garrysmod.org/img/dl/76249_2.jpg[/IMG] [IMG]http://s3.garrysmod.org/img/dl/76249_3.jpg[/IMG] All of these are the same code, with the scalar value for the widget changed. Download: [url=http://www.garrysmod.org/downloads/?a=view&id=76324][img]http://www.garrysmod.org/img/?t=dll&id=76324[/img][/url] This is currently aimed at devs, I'll add some derma to adjust your own widgets and such later. Maye even release a big pack of them. I'll be adding text support and more next release.
Your vista(?) theme is sick, what is it? [B][I]EDIT:[/I][/B] It kind of looks like a different theme but I'm not sure actually. Maybe it's just the colors or the fact that the bottom tabs don't have words. Also isn't this basically just an ingame derma editor? Something developers can use to touch up huds or find the perfect size for things? That is what it looks like to me.
[QUOTE=find me;16710413]Your vista(?) theme is sick, what is it? It kind of looks like a different theme but I'm not sure actually. Maybe it's just the colors or the fact that the bottom tabs don't have words. Also isn't this basically just an ingame derma editor? Something developers can use to touch up huds or find the perfect size for things? That is what it looks like to me.[/QUOTE] It's something that allows you to create HUDs using primitive drawing functions that automatically resize so no matter the resolution, the size of the widgets fullscreen will always be the exact same, not pixel wise, though. The HUDs(widgets) created with this are also scalable, and moveable. I haven't put anything in to make it simple to move or rescale the widgets yet, though so here are the functions that you'll want to use with lua_run_cl: [lua] Widget.GetByName(string) Widget.Scale(widget, integer) Widget.ScaleH(widget, integer) Widget.ScaleW(widget, integer) Widget.SetXPos(widget, integer) Widget.SetYPos(widget, integer) [/lua] Just noticed I made a mistake in Widget.SetPos() which takes a table instead of an integer. Forgot to convert it from the old way of doing it. In short: If I make a health bar with this using a 1440x1020 res, it'll look the exact same size-wise on a 800*600 fullscreen, not HUGE. [b]Edit:[/b] Alright, I'll write up some documentation. If you guys can figure it out, which I'm sre some of you can if you want to, I invite you to create widgets :D Just a quick note, the offset in parenting is from the EDGE of the other part. To center it, make the offset "CENTER".
I may take a look at playing around with this when I get back from Florida tomorrow. Also, his "theme" is actually a completely different operating system. Windows 7. And I like it's taskbar more *shrug* Pretty cool idea though :D
[QUOTE=find me;16710413]Your vista(?) theme is sick, what is it? [B][I]EDIT:[/I][/B] It kind of looks like a different theme but I'm not sure actually. Maybe it's just the colors or the fact that the bottom tabs don't have words.[/QUOTE]Windows 7. Anyway, haven't I seen something like this before? It seems fairly familiar...
[QUOTE=Lexic;16711646]Windows 7. Anyway, haven't I seen something like this before? It seems fairly familiar...[/QUOTE] I'm fairly sure you haven't. Adding text support soon, and releasing with documentation.
Is the control over the widgets (positioning, resizing, parenting) ingame or specified in the files? Oh and, [url=http://wiki.garrysmod.com/?title=Silkicons]the heart is included in GMod by default[/url].
[QUOTE=Overv;16712192]Is the control over the widgets (positioning, resizing, parenting) ingame or specified in the files? Oh and, [url=http://wiki.garrysmod.com/?title=Silkicons]the heart is included in GMod by default[/url].[/QUOTE] It's defined in a file, but I'm working on in-game modification being simpler and making it so it's less dev oriented and more for the player like "Woah cool, I can rearrange the HUD.", right now you CAN parent and modify the parts in-game if you really wanted to, but it'd be a tad hard, and not very intuitive. Eventually I am going to make it so you can place boxes by the different locations, like the center, and right corner. I'm working on a parenting 'anchor' integer right now, so you can anchor the child to a specific corner, and then have the modifier apply to that. [b]Edit: [/b] Right now the parenting applies to the edge of the parent, and the left corner of the child.
[QUOTE=Lexic;16711646]Windows 7. Anyway, haven't I seen something like this before? It seems fairly familiar...[/QUOTE] Maybe [url=http://www.facepunch.com/showthread.php?t=552246]this?[/url]
That's quite a bit different, but the same concept, actually. It doesn't scale though, or resize automatically to adjust for screen size.
Alright well new DL is up, but I've got a problem. While the first widget works, the second parents VERY oddly. A little help would be nice :D
Sorry, you need to Log In to post a reply to this thread.