Re: EGS v2 - Screenshots! Redesign! (Easy GUI System)
Posted: Sat Aug 27, 2011 1:18 am
main.lua tries to load an mp3 that isn't included with the source.
chrism wrote:main.lua tries to load an mp3 that isn't included with the source.
Because it can be used for other things I make and in the off chance somone uses two or more of things I make they only end up requiring it once.chrism wrote:Another small thing, there's no math.randomseed() so the colors are always the same.
edit- why does main.lua have to require Class.lua? Why isn't it done by the library modules that need it?
Code: Select all
function giveTheme(element)
element.toolTipVisible = true
element.toolTipText = element.className..": "..element.name
element.backgroundColor = {math.random(1,255),math.random(1,255),math.random(1,255)}
element.borderColor = {math.random(1,255),math.random(1,255),math.random(1,255)}
end
OK, I guess I can I rename it to something else less generic then.Trappingnoobs wrote:Because it can be used for other things I make and in the off chance somone uses two or more of things I make they only end up requiring it once.chrism wrote:Another small thing, there's no math.randomseed() so the colors are always the same.
edit- why does main.lua have to require Class.lua? Why isn't it done by the library modules that need it?
That's exactly what is already in your main.lua; what I was saying is that there is no math.randomseed() call in your main.lua, so the colors end up always being the same. It seemed to me like an small oversight and not exactly what you intended, that's all.Trappingnoobs wrote: Dude to make them have random colors just change their BorderColor etc, here's some sample source:
Replace GiveTheme with this:
Each element has loads of global properties and some properties only it has. Check out GUIClassDeclerations.lua and look at the properties. Those are in GUI elements. Don't change the ones in GUIClassDecleration though, unless you want all new GUIs to look like that.Code: Select all
function giveTheme(element) element.toolTipVisible = true element.toolTipText = element.className..": "..element.name element.backgroundColor = {math.random(1,255),math.random(1,255),math.random(1,255)} element.borderColor = {math.random(1,255),math.random(1,255),math.random(1,255)} end
It's only made to be an example, I'd expect people to edit it, because the outcome of that code will usualy be ugly anyway.chrism wrote:OK, I guess I can I rename it to something else less generic then.Trappingnoobs wrote:Because it can be used for other things I make and in the off chance somone uses two or more of things I make they only end up requiring it once.chrism wrote:Another small thing, there's no math.randomseed() so the colors are always the same.
edit- why does main.lua have to require Class.lua? Why isn't it done by the library modules that need it?
That's exactly what is already in your main.lua; what I was saying is that there is no math.randomseed() call in your main.lua, so the colors end up always being the same. It seemed to me like an small oversight and not exactly what you intended, that's all.Trappingnoobs wrote: Dude to make them have random colors just change their BorderColor etc, here's some sample source:
Replace GiveTheme with this:
Each element has loads of global properties and some properties only it has. Check out GUIClassDeclerations.lua and look at the properties. Those are in GUI elements. Don't change the ones in GUIClassDecleration though, unless you want all new GUIs to look like that.Code: Select all
function giveTheme(element) element.toolTipVisible = true element.toolTipText = element.className..": "..element.name element.backgroundColor = {math.random(1,255),math.random(1,255),math.random(1,255)} element.borderColor = {math.random(1,255),math.random(1,255),math.random(1,255)} end