[QUOTE=kulcris;50248322]yeah.,.... sad thing is... i basically dropped out of highschool XD....im at about... 10th grade lvl math. got my GED and then didnt pay attention in any other classes XD[/QUOTE]
I dropped out of high school in 10th grade and never got past pre-algebra before then. The following year I got my CHSPE, caught my math (and English!) skills up with [url=https://www.khanacademy.org/]Khan Academy[/url], and enrolled in city college. Trig alone is something you NEED to know to program in almost all areas. Trust me, your reasoning is fucking stupid and you won't regret learning this shit. Programming is the greatest thing that ever happened to me; not because of what I've made, but from what I've learned. The things you do in programming (AND math) can be applied to everyday life in amazing ways you could never imagine.
[QUOTE=kulcris;50250608]you must live an exciting life ;)[/QUOTE]
and stop that. You're being an ass.
[QUOTE=man with hat;50241004]Some controls themed after Visual Studio.
[IMG]http://i.imgur.com/x6uEdw6.gif[/IMG]
First time I'm really doing something like this in lua. Looking forward to doing many more controls. I have a textentry and tooltip control but those are incomplete and kinda hard.[/QUOTE]
How well does the client handle this?
Does it impact FPS much?
[QUOTE=code_thrax;50251598]How's the lag compensation on this?[/QUOTE]
The what? What is lag compensation in the context of GUIs?
[QUOTE=man with hat;50251869]The what? What is lag compensation in the context of GUIs?[/QUOTE]
You know what I mean. Lag compensation is server-side.
I'll be changing my wording in that post.
[vid]https://dl.dropboxusercontent.com/u/40443211/Share/2016-05/2016-05-03_20-33-45.mp4[/vid]
I made a dynamic radial menu library that just about any addon can interface with. Its still a WIP, not very exciting, but still fun to play around with. In the video above you can see I have my admin mod set to open it up, but you could still do things like replace the context menu with it / etc.
[QUOTE=code_thrax;50251993]You know what I mean. Lag compensation is server-side.
I'll be changing my wording in that post.[/QUOTE]
Oh. There's no effect on performance.
[QUOTE=man with hat;50252349]Oh. There's no effect on performance.[/QUOTE]
:snip:
...What? By at least one frame? What do you see there that could possibly affect performance in any significant way?
[QUOTE=McDunkable;50252502]...What? By at least one frame? What do you see there that could possibly affect performance in any significant way?[/QUOTE]
One frame isn't a significant difference.
I'm somewhat new to Lua, I guess I'm confusing different Lua elements with the elements you use for creating something like this.
Speaking of which, what would you use in order to create something like this? Is it just some derma manipulation or what?
[QUOTE=code_thrax;50252542]One frame isn't a significant difference.
I'm somewhat new to Lua, I guess I'm confusing different Lua elements with the elements you use for creating something like this.
Speaking of which, what would you use in order to create something like this? Is it just some derma manipulation or what?[/QUOTE]
All it is is drawing shapes. It sounds more complicated than it is.
[url]http://wiki.garrysmod.com/page/Derma_Basic_Guide[/url]
Look at the "Painting Derma" section.
[Disclaimer]: Again, I'm very new to coding, so this may appear as utter shit to you. Also this is VERY WIP.
Here's a little project I decided to start!
[IMG]http://images.akamai.steamusercontent.com/ugc/263835706284439168/7705BC8EC1AC525772B98FAD21DF7E8195F9CF74/[/IMG]
[I]also I wanted to use lerp on the red progress bar, but I have no idea, so if anyone wants to help that would be 10/10[/I]
My Frame wasn't center, that's fixed. Also I added in a bunch of sliding "animations" when closing/opening the menu. It'll move to/come from 3 different positions off the side of your screen.
Left, Right, Down. :-)
[QUOTE=dimitrik129;50245595]What is a suggested size for a hat texture? I am currently using 1024x1024 (Is that too big or too small?). I can either go: [B]low res[/B] - fastdownload, shitty looking / [B]higher res[/B] - slowdownload, nice looking.[/QUOTE]
Why the hell would anyone want a 1024x1024 hat?! You'd have to use a microscope to even see that level of detail
[QUOTE=dannyf127;50253498][Disclaimer]: Again, I'm very new to coding, so this may appear as utter shit to you. Also this is VERY WIP.
Here's a little project I decided to start!
[IMG]http://images.akamai.steamusercontent.com/ugc/263835706284439168/7705BC8EC1AC525772B98FAD21DF7E8195F9CF74/[/IMG]
[I]also I wanted to use lerp on the red progress bar, but I have no idea, so if anyone wants to help that would be 10/10[/I][/QUOTE]
What do you mean by "have no idea"?
Lerp just means linear interpolation, you give it a start value, an end value, and a 0-1 weight value, and it'll return a number. If you give it a weight of 0.5, it'll give you the halfway point between the start and end, similarly 0.25 will give you a quarter, 0.75 three quarters, etc
[QUOTE=Instant Mix;50254384]What do you mean by "have no idea"?
Lerp just means linear interpolation, you give it a start value, an end value, and a 0-1 weight value, and it'll return a number. If you give it a weight of 0.5, it'll give you the halfway point between the start and end, similarly 0.25 will give you a quarter, 0.75 three quarters, etc[/QUOTE]
Right, but that's all I know.. How would I apply it to lets just say max 100 health, min 0.
Tried to see if gradients could be done through code (without 100s of surface.DrawLine/Rect calls and thus suffering FPS drops) since everyone seemed to just use images/materials. Was easier than I thought.
[img]https://i.imgur.com/nQLaDKw.png[/img]
(light blue background is the skybox so the middle-right gradient is fading to transparency)
Point behind it was mainly to experiment with how the internals of the surface library work. I don't have anything that this would be used in.
[QUOTE=dannyf127;50255054]Right, but that's all I know.. How would I apply it to lets just say max 100 health, min 0.[/QUOTE]
I'm sorry, I don't really understand what you're asking. What do you mean by that? What are you trying to use lerp to acheive?
[QUOTE=Bo98;50255058]gradients[/QUOTE]
How did you accomplish this?
[QUOTE=Instant Mix;50255063]I'm sorry, I don't really understand what you're asking. What do you mean by that? What are you trying to use lerp to acheive?[/QUOTE]
Sorry If I'm being unclear,
I want to smooth the progress of a bar instead of it being instant.
weight 1
start value 0 <---min health
end value 30
how would i make this work with something such as
surface.DrawRect(x,y 300* (ply:Health() /ply:GetMaxHealth()), 30)
or something like that?
[QUOTE=101kl;50255109]How did you accomplish this?[/QUOTE]
Meshes. I can release the code if you want.
[QUOTE=Bo98;50255236]Meshes. I can release the code if you want.[/QUOTE]
please <3
[QUOTE=dannyf127;50255135]Sorry If I'm being unclear,
I want to smooth the progress of a bar instead of it being instant.
weight 1
start value 0 <---min health
end value 30
how would i make this work with something such as
surface.DrawRect(x,y 300* (ply:Health() /ply:GetMaxHealth()), 30)
or something like that?[/QUOTE]
Right, so you've got to think about what you're trying to achieve.
A really basic way to deal with this is to do something like ( this is pseudocode btw)
[code]
a = lerp(a,b,0.1)
[/code]
If you put that in a think function, A will get 10% closer to B every frame. Obviously this is ludicrously slow, so something like 0.75 would be more appropriate.
The issue with this though is that if you are running at 10fps, it will take severely longer for this to happen than if you were running at 120fps.
If you were to attempt something like
[code]
a = lerp(a,b,1 - x^dt)
[/code]
where dt is your game time delta. Can't remember the exact function, have a wee look in the wiki.
X is 1/weight, but this will smooth regardless of the framerate.
If you're trying to make a bar like that, I would do something like
[code]
-- initial function
bar = {
maxWidth = 300,
minWidth = 0,
curWidth = 300,
destWidth = 300
}
--- draw or think function
plyHealthRatio = ply:Health()/ply:GetMaxHealth();
bar.destWidth = math.clamp(plyHealthRatio*bar.maxWidth,bar.minWidth,bar.maxWidth);
bar.curWidth = math.lerp(bar.curWidth,bar.destWidth,1-0.25^FrameTime());
--- draw function
surface.DrawRect(x,y,bar.curWidth,30)
[/code]
Could be bollocks, probably not efficient but would do what you are asking
I apologise , I know this isn't really the correct thread for this but would rather get it done and dusted here. All further comments danny should really be in the "What do you need help with" thread.
[QUOTE=Instant Mix;50255334]
I apologise , I know this isn't really the correct thread for this but would rather get it done and dusted here. All further comments danny should really be in the "What do you need help with" thread.[/QUOTE]
Thank you for the quick lesson, and you're right all further comments should be focussed on the orignal discussion. Thanks again!
Source code for this: [url]https://github.com/Bo98/garrysmod-util/blob/master/lua/autorun/client/gradient.lua[/url]
There is one caveat: x/y coordinates are [I]not[/I] relative to panels' positions etc. when done in their paint hooks. This is inconsistent to other draw/surface functions. This can only be fixed once [url]https://github.com/Facepunch/garrysmod-requests/issues/732[/url] is added.
So far only linear gradients that are either strictly horizontal or vertical are supported (ie. no diagonal gradients). I might add support for more later.
[QUOTE=Bo98;50255058]Tried to see if gradients could be done through code (without 100s of surface.DrawLine/Rect calls and thus suffering FPS drops) since everyone seemed to just use images/materials. Was easier than I thought.
[img]https://i.imgur.com/nQLaDKw.png[/img]
(light blue background is the skybox so the middle-right gradient is fading to transparency)
Point behind it was mainly to experiment with how the internals of the surface library work. I don't have anything that this would be used in.[/QUOTE]
Making an editor for [URL="https://github.com/szymski/QuantumChip"]my in-game scripting language[/URL].
Does it look ok so far? What would you change?
[IMG]http://url.szymekk.me/raypw[/IMG]
[media]https://www.youtube.com/watch?v=zDab9ykYu1w[/media]
This is heavy work in progress, just wanted to show what spawnmenu could become.
( Ignore the scanning spawnmenu stuff and the lack of margins on the spawnmenu )
[QUOTE=dannyf127;50255135]Sorry If I'm being unclear,
I want to smooth the progress of a bar instead of it being instant.
weight 1
start value 0 <---min health
end value 30
how would i make this work with something such as
surface.DrawRect(x,y 300* (ply:Health() /ply:GetMaxHealth()), 30)
or something like that?[/QUOTE]
Make a health variable out of the paint hook and on the paint hook put this
[CODE]local velocity = 10 -- the speed of the transition
health =Lerp(FrameTime() * velocity, health, ply:Health())[/CODE]
And there you have the health that doesn't instantly change, it changes by being each time more near to its final value.
You'll see what I'm saying.
[img]http://i.imgur.com/k83r5zk.png[/img]
RP gamemode character selection