AggrorJorn Posted June 20, 2010 Share Posted June 20, 2010 Had to repost due to the server change. Here is WIP 1: http://www.youtube.com/watch?v=Ai-c0Vyop1w WIP 2. Small update on the simple LuaGui. You can easily add text: button1:SetButtonText("Leadwerks") Set a font: button1:SetButtonFont("Arial12Shadow") Set the fontcolor for normal, hover and click: button1:SetFontColor(Vec4(0,0,1,1),Vec4(0,1,0,1),Vec4(1,1,0,1)) Set the text position to the 9 button positions (see the image) and the margin on the X and Y axis. button1:SetTextPosition("UpperLeft",0,0) WIP 3. This was made way quicker then I had anticipated: Autoscaling and AutoPositioning for different resolutions. button1:SetBaseResolution(400,300) Important! Has to be placed directly after the button has been created! Lets say you create a button in a screen 400 x 300. The button is placed at Vec2(50,50) and has a size of 75 x 30. When the user uses a new resolution of 800 x 600, your image would be the same size and still be placed at Vec2(50,50). With the SetBaseResolution() command the new position of the button would be Vec2(100,100) and the size of the button would be 150 x 60. Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted June 20, 2010 Author Share Posted June 20, 2010 So far it has been quite fun to make this. I think that I am going to extend this with extra button types after all . Never created such a working and functional project before. At the moment 1 button can be used with the following: --Creation and reslution button1 = LuaGui.CreateButton() button1:SetBaseResolution(400,300) --images and position button1:SetImages("abstract::a.dds","abstract::a.dds","abstract::a.dds") button1:Position(0,100) --text button1:SetButtonFont("Arial12Shadow") button1:SetFontColor(Vec4(0,0,1,1),Vec4(0,1,0,1),Vec4(1,1,0,1)) button1:SetButtonText("Leadwerks") button1:SetTextPosition("Center",0,0) --main loop button1:UpdateButton() button1:MouseClicked() button1:MouseHold() --main loop, after fw:Render() button1:DrawButton() Only thing left to do is creating callbacks or callback function for the Mouse events. Instead of having the main loop to constanly check for an event, you can make the event before the main loop (like a function). Feedback welcome. Do you like the function names? For instance: button1:SetButtonText("Leadwerks") button1:SetTextPosition("Center",0,0) or button1:SetButtonText("Leadwerks") button1:SetButtonTextPosition("Center",0,0) This, to create more consistency in the functions name. But at the cost of the length of a function name. Quote Link to comment Share on other sites More sharing options...
AndyGFX Posted June 20, 2010 Share Posted June 20, 2010 Looks good. I have only small comment to method names. You don't need add "Button" to method again when object is inherited from button class. Developer knows of what was created. Quote [HW] C2D Q6600, 4GB RAM, NV8800GTX, Vista Ultimate x64 [sW] Blide Plus, BlitzMax, Delphi, C++, 3DWS 5.53, Leadwerks 2.xx Link to comment Share on other sites More sharing options...
ZioRed Posted June 21, 2010 Share Posted June 21, 2010 Nice, and agree con Andy, "Button" is redundant. And you can easily create a base class like "GuiElement" which have some of these methods (for sure Position, Update and Draw) so Button can extend it. Quote ?? FRANCESCO CROCETTI ?? http://skaredcreations.com Link to comment Share on other sites More sharing options...
AggrorJorn Posted June 21, 2010 Author Share Posted June 21, 2010 okay Thanks, I ahve been wondering about that. The commands will be changed to: button1:SetText("Leadwerks") button1:SetTextPosition("Center",0,0) Quote Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Share Posted October 6, 2011 How to use this ? is there any kind of ready to use example for this? that you can try it out yourself? Quote Link to comment Share on other sites More sharing options...
Laurens Posted October 6, 2011 Share Posted October 6, 2011 I don't think Aggror is still around, I'm not sure if this would even run anymore. Quote Link to comment Share on other sites More sharing options...
dennis Posted October 6, 2011 Share Posted October 6, 2011 I don't think Aggror is still around, I'm not sure if this would even run anymore. ahaa, okay then. will find it out myself eventually Quote Link to comment Share on other sites More sharing options...
Josh Posted October 7, 2011 Share Posted October 7, 2011 He was on a few days ago. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
dennis Posted October 10, 2011 Share Posted October 10, 2011 Then he is just busy. we all are, sometimes Quote Link to comment Share on other sites More sharing options...
AggrorJorn Posted October 10, 2011 Author Share Posted October 10, 2011 Yeps I am still here. School is the reason for my absence. I have been to busy with projects and homework to spend any time with LE. Apparently the LUA example page is no longer intact. I can see if I have a backup on my external hd somewhere.` http://www.leadwerks.com/werkspace/files/file/155-luagui/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.