Exporting to code/script
finished basic exporting to lua or c++ code.
the screenshot below results in the following files based on ExportType.
Menu.lua
--GUI Editor Generated function BuildMenu(context) local Menu = {} local scale = 1 --GUI local gui = GUI:Create(context) gui : SetScale(scale) Menu.gui=gui Menu.context=context --Panel Menu.Panel = Widget:Create("", 0, 0, 1024, 80, gui:GetBase(), "Scripts/GUI/Panel.lua") Menu.Panel:SetAlignment(true, true, true, false) --Button Menu.Button = Widget:Create("Template", 104, 32, 150, 20, Panel, "Scripts/GUI/Button.lua") Menu.Button:SetAlignment(false, false, false, false) --Button1 Menu.Button1 = Widget:Create("Template", 409, 33, 150, 20, Panel, "Scripts/GUI/Button.lua") Menu.Button1:SetAlignment(false, false, false, false) --Button2 Menu.Button2 = Widget:Create("Template", 782, 34, 150, 20, Panel, "Scripts/GUI/Button.lua") Menu.Button2:SetAlignment(false, false, false, false) --MenuPanel Menu.MenuPanel = Widget:Create("", 250, 249, 500, 300, gui:GetBase(), "Scripts/GUI/Panel.lua") Menu.MenuPanel:SetAlignment(true, true, true, true) --Button3 Menu.Button3 = Widget:Create("Start", 172, 52, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Menu.Button3:SetAlignment(false, false, false, false) --Button4 Menu.Button4 = Widget:Create("Exit", 167, 238, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Menu.Button4:SetAlignment(false, false, false, false) --Button5 Menu.Button5 = Widget:Create("Options", 168, 145, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Menu.Button5:SetAlignment(false, false, false, false) --Button6 Menu.Button6 = Widget:Create("adwadwdaw", 169, 98, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Menu.Button6:SetAlignment(false, false, false, false) -- function Menu:Show() self.gui:Show() end -- function Menu:Hidden() return self.gui:Hidden() end -- function Menu:Hide() return self.gui:Hide() end -- function Menu:ProcessEvent(event) if event.id == Event.WindowSize then -- elseif event.id == Event.WidgetAction -- end end -- return Menu end
Menu.h
//GUI Editor Generated #pragma once #include "Leadwerks.h" using namespace Leadwerks; class MenuClass { public: GUI* gui; // Widget* Panel; Widget* Button; Widget* Button1; Widget* Button2; Widget* MenuPanel; Widget* Button3; Widget* Button4; Widget* Button5; Widget* Button6; // MenuClass(); ~MenuClass(); // bool ProcessEvent(Event event); bool Update(); };
Menu.cpp
//GUI Editor Generated #include "MenuClass.h" MenuClass::MenuClass(Context* context) { gui = GUI::Create(context) //Panel Panel = Widget::Create("", 0, 0, 1024, 80, gui->GetBase(), "Scripts/GUI/Panel.lua") Panel->SetAlignment(true, true, true, false) //Button Button = Widget::Create("Template", 104, 32, 150, 20, Panel, "Scripts/GUI/Button.lua") Button->SetAlignment(false, false, false, false) //Button1 Button1 = Widget::Create("Template", 409, 33, 150, 20, Panel, "Scripts/GUI/Button.lua") Button1->SetAlignment(false, false, false, false) //Button2 Button2 = Widget::Create("Template", 782, 34, 150, 20, Panel, "Scripts/GUI/Button.lua") Button2->SetAlignment(false, false, false, false) //MenuPanel MenuPanel = Widget::Create("", 250, 249, 500, 300, gui->GetBase(), "Scripts/GUI/Panel.lua") MenuPanel->SetAlignment(true, true, true, true) //Button3 Button3 = Widget::Create("Start", 172, 52, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Button3->SetAlignment(false, false, false, false) //Button4 Button4 = Widget::Create("Exit", 167, 238, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Button4->SetAlignment(false, false, false, false) //Button5 Button5 = Widget::Create("Options", 168, 145, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Button5->SetAlignment(false, false, false, false) //Button6 Button6 = Widget::Create("adwadwdaw", 169, 98, 150, 20, MenuPanel, "Scripts/GUI/Button.lua") Button6->SetAlignment(false, false, false, false) } MenuClass::~MenuClass() { Button6->Release(); Button5->Release(); Button4->Release(); Button3->Release(); MenuPanel->Release(); Button2->Release(); Button1->Release(); Button->Release(); Panel->Release(); gui->Release(); } // bool MenuClass::ProcessEvent(Event event) { if (event.id == Event::WidgetAction) { // } return true; } // bool MenuClass::Update() { return true; }
next step will be adding stuff like Widget->SetString(), Widget->SetBool(), Widget->SetObject() and list type Widgets.
after that i will be adding support for custom widgets.
- 1
0 Comments
Recommended Comments
There are no comments to display.