chrisknapp001 Posted February 24, 2019 Share Posted February 24, 2019 Why can´t the GUI be used like any other? A canvas/base in pixels, with elements like button (e.g Torque 2d), rendered on a layer above the graphics. This has to be included - GUI must be ueable, presently it is only for off-game-menus. Thanks, i paid a lot of money for leadwerks pro, but the GUI has to work. Please fix this ASAP. Regards, Chris Quote Link to comment Share on other sites More sharing options...
Josh Posted February 26, 2019 Share Posted February 26, 2019 How is it not usable? Do you mean for an in-game menu on 3D surfaces? 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...
chrisknapp001 Posted February 27, 2019 Author Share Posted February 27, 2019 No, simply: move fps player with keys. and have a button useable with the mouse. And this must be possible. Quote Link to comment Share on other sites More sharing options...
Josh Posted February 27, 2019 Share Posted February 27, 2019 What is preventing you from creating this? Our template is only an example of what you can do with the menu system. 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...
gamecreator Posted February 27, 2019 Share Posted February 27, 2019 He's using Pro so C++, right? In his defense, the Widget and GUI documentation sections still don't have a single C++ example to go off of. Should I submit that to Bugs forum? That said, it should be very possible to handle keyboard and mouse input with Leadwerks using the Windows commands here: https://www.leadwerks.com/learn?page=API-Reference_Object_Window You can also draw your own buttons by using DrawImage. Quote Link to comment Share on other sites More sharing options...
Josh Posted February 27, 2019 Share Posted February 27, 2019 Here is an example for the button command, set up to work with the styles system in version 4.6: #include "Leadwerks.h" using namespace Leadwerks; int main(int argc, const char *argv[]) { auto window = Window::Create(); auto context = Context::Create(window); auto gui = GUI::Create(context); auto base = gui->GetBase(); base->SetScript("Scripts/GUI/Panel.lua"); int x = 20; int y = 20; int sep = 30; auto button = Widget::Button("Push", x, y, 76, 26, base); y = y + sep; auto checkbox = Widget::Button("Checkbox", x, y, 76, 26, base); //Retrieve the style constant from the script Interpreter::GetGlobal("BUTTON_CHECKBOX"); int style = Interpreter::ToNumber(); checkbox->SetStyle(style); while (!window->Closed()) { if (window->KeyHit(Key::Escape)) break; while (EventQueue::Peek()) { auto event = EventQueue::Wait(); if (event.id == Event::WidgetAction) { System::Print("WidgetAction"); } else if (event.id == Event::WidgetSelect) { System::Print("WidgetSelect"); } } context->Sync(); } } 1 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...
Josh Posted February 27, 2019 Share Posted February 27, 2019 This is a little safer: //Retrieve the style constant from the script int stacksize = Interpreter::GetStackSize(); Interpreter::GetGlobal("BUTTON_CHECKBOX"); if (Interpreter::IsNumber()) { int style = Interpreter::ToNumber(); checkbox->SetStyle(style); } Interpreter::SetStackSize(stacksize); 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...
gamecreator Posted February 27, 2019 Share Posted February 27, 2019 We can do auto in 4.6 now? Quote Link to comment Share on other sites More sharing options...
Josh Posted February 27, 2019 Share Posted February 27, 2019 Oh yeah, that is supported in all versions. I've just gotten used to it and I use it a lot now. 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...
Josh Posted February 28, 2019 Share Posted February 28, 2019 The widget scripts declare their own style constants in the script, but the script is not run until the first time it is used. For C++ this poses a problem because the style constant only exists in the Lua virtual machine. It can be retrieved, but this seems needlessly complicated, as shown above. What I will do is declare the style constants for the default widget scripts in the engine, so they are easily accessible from C++ and Lua. There aren't actually that many, just a few for button and label settings, so although this solution is sort of inconsistent I think it will be the easiest on everyone. The whole reason for this complication is the fact that the widget system is totally customizable, and you can insert completely new types of GUI elements you create yourself with a new script. 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...
chrisknapp001 Posted March 2, 2019 Author Share Posted March 2, 2019 I follow your example. A button appears, with a black background. My world disappear, with all model in it, of course. This just dont work. Quote Link to comment Share on other sites More sharing options...
reepblue Posted March 2, 2019 Share Posted March 2, 2019 Josh, It'll be nice to see this kind of stuff on the API reference under the C++ examples. 1 Quote Cyclone - Ultra Game System - Component Preprocessor - Tex2TGA - Darkness Awaits Template (Leadwerks) If you like my work, consider supporting me on Patreon! Link to comment Share on other sites More sharing options...
Josh Posted March 6, 2019 Share Posted March 6, 2019 On 3/2/2019 at 4:27 AM, chrisknapp001 said: I follow your example. A button appears, with a black background. My world disappear, with all model in it, of course. This just dont work. This is happening because the base GUI object, which can be thought of as a "desktop" is being assigned a panel script. If you don't want it to be a solid color, you can just skip that step and it will be invisible. This is how the default menu system is done. 1 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...
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.