Jump to content
Acnologia

I can't add the button with image via c++

Recommended Posts

GUI* gui = GUI::Create(context);
Widget* base = gui->GetBase(); 

base->SetScript("Scripts/GUI/Panel.lua");

Widget* button = Widget::Button("Spawn", 20, 20, 100, 40, base);
button->SetScript("Scripts/GUI/Button.lua");

Image* img = new Image();
std::cout << img->Initialize(L"Materials/Developer/bluegrid.tex") << std::endl;
button->SetImage(img);

 

I used standard lua scripts.

Link to post

if i remember correctly you need the GUI to initialize the image.

example:

logo = Widget::Panel( 0, 0, gui->GetBase()->GetClientSize().width, gui->GetBase()->GetClientSize().height, gui->GetBase());
logo->SetScript("Scripts/GUI/Custom/ImagePanel.lua");
Image* logoImg = gui->LoadImageA("Materials/Logo/leadwerks_logo.tex");
logo->SetImage(logoImg);
logo->Redraw();
logoImg->Release();

 

  • Like 1
  • Thanks 1
Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...