Widgets - Scalable, Moveable, Resizing HUD elements

A widgets system, these can be resized and moved by the end user.

http://s3.garrysmod.org/img/dl/76249_1.jpg

http://s3.garrysmod.org/img/dl/76249_2.jpg

http://s3.garrysmod.org/img/dl/76249_3.jpg

All of these are the same code, with the scalar value for the widget changed.

Download:
http://www.garrysmod.org/img/?t=dll&id=76324

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? EDIT: 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.

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.

Edit:
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 :smiley:

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 :smiley:

Windows 7.
Anyway, haven’t I seen something like this before? It seems fairly familiar…

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, the heart is included in GMod by default.

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.

**Edit: **
Right now the parenting applies to the edge of the parent, and the left corner of the child.

Maybe this?

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 :smiley: