• DermaDesigner
    549 replies, posted
I posted it in hurry. Went to my friends house. Didn't realy think about it.
You definitely should add DPropertySheet next, if I knew more of the C languages I would help :P
If you are planning on adding some sort of importer that imports designs straight from lua files, you could try having the program create a lua instance, and running the following script: [lua] local EmptyFunction = function() print( "Ignored GLua function call..." ) end local metaFakeModule = { __index = function() return EmptyFunction end } local Modules = { "vgui", "derma", "draw", "surface", "render", "ents", "hook", "concommand" } for _, key in pairs( Modules ) do _G[ key ] = setmetatable( {}, metaFakeModule ) end function ScrW() return 800 end function ScrH() return 600 end function LocalPlayer() return setmetatable( {}, metaFakeModule ) end RunConsoleCommand = EmptyFunction local Panels = {} local BasePanel = {} function BasePanel:SetPos( x, y ) self.X = x self.Y = y end function BasePanel:GetPos() return self.X, self.Y end function BasePanel:SetSize( w, h ) self.W = w self.H = h end function BasePanel:GetSize() return self.W, self.H end function vgui.Create( nm, parent ) local o = setmetatable( {}, metaFakeModule ) o.Class = nm o.Parent = parent for key, val in pairs( BasePanel ) do o[ key ] = val end o:SetPos( 0, 0 ) o:SetSize( 0, 0 ) table.insert( Panels, o ) return o end -- Run script to import from here for _, p in pairs( Panels ) do local cl = p.Class local func = _G[ "Handle" .. cl ] if (not func) then print( "Failed to handle panel '" .. cl .. "'!" ) else func( p ) print( "Handled panel '" .. cl .. "'!" ) end end[/lua] It basically fakes GLua functions, and tries to get a script to work without erroring. It's far from perfect, and the user would have to "trim" away useless stuff around the actual UI (including any hooks or functions). But all you'd need to do is extend the BasePanel table a bit to read more information from the code, and bind functions such as HandleDPanel, HandleDButton, HandleDLabel etc to c# functions that read the first parameter as a lua table and create the element in the designer.
Does anyone know how to get lua running in C#? And as for the key confusion: Control = parent a panel Shift = move a panel 10 pixels instead of 1 when pressing the arrow keys
[QUOTE=yakahughes;22106023]Does anyone know how to get lua running in C#? And as for the key confusion: Control = parent a panel Shift = move a panel 10 pixels instead of 1 when pressing the arrow keys[/QUOTE] Maybe these can help: [url]http://www.gamedev.net/reference/articles/article2275.asp[/url] [url]http://www.ppl-pilot.com/KopiLua/[/url] [url]http://einfall.blogspot.com/2006/05/scripting-with-lua-in-c.html[/url]
[QUOTE=the fonix232;22097813]Gbps Just a question. In the updater, why do you use two separate functions to download the update? The GetBuildVersion() function is meaningless, you could just put the Regex buildfinder = new Regex("Build([0-9][0-9][0-9]).zip") to the Client.DownloadFile() call![/QUOTE] I did this because the next update will have version checking, which requires a separate function.
[QUOTE=yakahughes;22106023]Does anyone know how to get lua running in C#? And as for the key confusion: Control = parent a panel Shift = move a panel 10 pixels instead of 1 when pressing the arrow keys[/QUOTE] I think those should be swapped to be honest.
[QUOTE=SnakeFace;22107082]I think those should be swapped to be honest.[/QUOTE] Its probably because he used a photo editing program, they almost all use shift for increased movement as far as I know.
I use photoshop a lot and the shift key makes a selection jump 10 pixels instead of one, so that's why it's that way.
I can get lua running in c++ easily, not sure about c# as I never used it - can c# link static lib files just like c++?
[QUOTE=Gbps;22106906]I did this because the next update will have version checking, which requires a separate function.[/QUOTE] Oh okay, I was thinking the same. Usually I don't code functions what I am not using in the same release :D [QUOTE=thomasfn;22108360]I can get lua running in c++ easily, not sure about c# as I never used it - can c# link static lib files just like c++?[/QUOTE] Yes it can, linked in three ways to do it - three separate wrapper library, and one (KopiLua or what is it called) is even a total transform of the Lua libraries into C# :D
[QUOTE=thomasfn;22108360]I can get lua running in c++ easily, not sure about c# as I never used it - can c# link static lib files just like c++?[/QUOTE] There's a wrapper for Luabind.
Updated:[list] [*]disabled multiselect for the toolbox [*]made the toolbox sort controls in alphabetical order [*]added DMultiChoice [*]added DComboBox [/list]
I like how this being progressed :) [editline]01:12AM[/editline] I dont know what you just did, but something is wrong, I suppose. [code]At revision: 22 One or more files are in a conflicted state.[/code] Gave me that after SVN updating it.
Updated, added DNumSlider, thanks SnakeFace.
Parenting is broken. [img]http://dl.dropbox.com/u/3656373/urr.jpg[/img]
Lol, I rarely code in C#, but, umm, I can try right? I never got lua to compile in C++ properly, but this is a idea Over-write the error function, parse it, if it has somthing other than derma, ignore it. [editline]08:15PM[/editline] Ill try to add that color thing. [editline]08:26PM[/editline] Horray! I added this to [url=http://wiki.garrysmod.com/?title=Derma]gmod.com![/url] because it looks so promising of course.
Yeah feel free to try, and thanks for adding it to the wiki. [editline]01:28AM[/editline] And wtb parenting, I'll take a look glitchvid.
Hehe, although, one question: Are you going to update it with the new derma design?
It worked for me, I just found a bug in the lua generation for the doclick function, but the parenting worked. What did you do to get that error? [editline]01:32AM[/editline] Map in a box, no, because the newer derma look is going to be more complicated to draw, and the more complicated to draw, the worse performance it's going to have. It won't affect how the derma turns out in gmod. [editline]01:37AM[/editline] Fixed the lua generation bug in DCheckBox
Please do DPropertySheet. It's the only thing I need help with at the moment.
That's probably going to be the hardest one and is going to consist of multiple panel types instead of just one like all the others. I might start work on it tomorrow.
If I could resize elements from other corners than the bottom right it would be really great. Otherwise a grid overlay which can be resized and lets you snap elements into place and size while keeping them in a nice and symmetrical and well designed would be wonderful. [editline]06:58PM[/editline] [QUOTE=Map in a box;22114146]Hehe, although, one question: Are you going to update it with the new derma design?[/QUOTE] It should be updated with the new design too.
[QUOTE=yakahughes;22114135]Yeah feel free to try, and thanks for adding it to the wiki. [editline]01:28AM[/editline] And wtb parenting, I'll take a look glitchvid.[/QUOTE] When i put / drag a button onto a frame it won't attach. (If I'm even doing it right)
Hold Control when you drag the item on to the panel you want to parent it to. We need some instructional guide or something. [editline]03:42AM[/editline] As well as making the grid, and making stuff optionally sizable by percent of screen.
[QUOTE=yakahughes;22116097]Hold Control when you drag the item on to the panel you want to parent it to. We need some instructional guide or something. [editline]03:42AM[/editline] As well as making the grid, and making stuff optionally sizable by percent of screen.[/QUOTE] Actually it only works for me when you place it the click the frame then on the item you want to parent.
You have to make sure to move your mouse after you have pressed and are holding control. You can't move it to where you want it, press control, and let go. You have to have it pressed [b]as you move the mouse[/b].
[QUOTE=yakahughes;22116687]You have to make sure to move your mouse after you have pressed and are holding control. You can't move it to where you want it, press control, and let go. You have to have it pressed [b]as you move the mouse[/b].[/QUOTE] The thing is that, from my experience, you can't hold control and drag the element from the controls box to a panel. You have to make it first and then parent it. It would be nice to be able to skip the extra step.
Oh I see what you mean. Yes, for now you have to drag it onto the workspace, release, hold control and drag again to parent. This might go away in the future to where you can just drag it directly on the panel while holding ctrl to parent, we'll see.
yakahughes, just an idea. If you're done with the Lua loading system, you could try to make it search through the GMod folder (the steam folder is registered into a key value in the system) and if it finds any derma skins, then let the user select a skin.
Sorry, you need to Log In to post a reply to this thread.