guiDynamicTexture (GuiTextureCanvas) revisited

Scripts and codes that enhances or changes the GUI in the engine.
38 posts Page 3 of 4
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sat Mar 18, 2017 5:21 pm
I have this working completely in my game, the only problem is mouse actions don't do anything.

I used the gui from the documentation as an example just to try with creating my own model for the gui object and all that the text is supposed to change to hello world u know that one?

Well when the mouse interacts with the object the button changes states to being pressed but the text doesnt change furthermore when i load up the options dialog i cant interact with anything the crosshair shows up as designed but no drop down menu or anything like that shows
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sat Mar 18, 2017 5:29 pm
An example of what i mean

Here u can see the gui in its default state
Image

then whenever u click the button
Image

it clearly changes but the text does not update.

Also do u think there is a way to get this to interact with key strokes? for typing in passwords and the like?
Azaezel
Posts: 383
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Sun Mar 19, 2017 5:50 am
Oddball. We use text on ours... I presume you're mapping the mat to the parent gui element?
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Sun Mar 19, 2017 5:48 pm
yea this is the full implementation in one material file for it:

Code: Select all

//--- OBJECT WRITE BEGIN ---
%guiContent = new GuiControl(TestGui) {
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   horizSizing = "right";
   vertSizing = "bottom";
   profile = "GuiDefaultProfile";
   visible = "1";
   active = "1";
   tooltipProfile = "GuiToolTipProfile";
   hovertime = "1000";
   isContainer = "1";
   canSave = "1";
   canSaveDynamicFields = "1";

   new GuiWindowCtrl() {
      text = "Hello World";
      resizeWidth = "1";
      resizeHeight = "1";
      canMove = "1";
      canClose = "1";
      canMinimize = "1";
      canMaximize = "1";
      canCollapse = "0";
      edgeSnap = "1";
      margin = "0 0 0 0";
      padding = "0 0 0 0";
      anchorTop = "1";
      anchorBottom = "0";
      anchorLeft = "1";
      anchorRight = "0";
      position = "0 0";
      extent = "630 463";
      minExtent = "8 2";
      horizSizing = "right";
      vertSizing = "bottom";
      profile = "GuiWindowProfile";
      visible = "1";
      active = "1";
      tooltipProfile = "GuiToolTipProfile";
      hovertime = "1000";
      isContainer = "1";
      canSave = "1";
      canSaveDynamicFields = "0";

      new GuiButtonCtrl() {
         text = "Click Me";
         groupNum = "-1";
         buttonType = "PushButton";
         useMouseEvents = "0";
         position = "139 207";
         extent = "140 30";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiButtonProfile";
         visible = "1";
         active = "1";
         command = "lblHWDisplay.setValue(\"Hello World\");";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "0";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
      new GuiTextCtrl(lblHWDisplay) {
         text = " Waiting...";
         maxLength = "1024";
         margin = "0 0 0 0";
         padding = "0 0 0 0";
         anchorTop = "1";
         anchorBottom = "0";
         anchorLeft = "1";
         anchorRight = "0";
         position = "68 127";
         extent = "313 64";
         minExtent = "8 2";
         horizSizing = "right";
         vertSizing = "bottom";
         profile = "GuiBigTextProfile";
         visible = "1";
         active = "1";
         tooltipProfile = "GuiToolTipProfile";
         hovertime = "1000";
         isContainer = "1";
         canSave = "1";
         canSaveDynamicFields = "0";
      };
   };
};
//--- OBJECT WRITE END ---


%guiContent = new GuiTextureCanvas(TestOffCanvas)
{
    guiControl = "TestGui";
   
};

singleton Material(ScreenTest_ScreenMaterial)
{
   mapTo = "ScreenMaterial";
   diffuseMap[0] = "$guiTestOffCanvas";
   materialTag0 = "GUIs";
};
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Mar 21, 2017 2:05 am
ive added an echo to the default bind

Image

It seems to be definitely picking up the click its just not updating the gui
Azaezel
Posts: 383
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Tue Mar 21, 2017 2:13 am
Just to make sure I'm not going batshit here, did the sample https://github.com/Azaezel/Torque3D/com ... d8eee690R1 function, ors that acting up your end as well?
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Mar 21, 2017 2:24 am
the example object and scrip doesnt interact at all, but heres the weird thing, when i clone ur github repo and build it, it all works but looks really funky, making the changes in 3.10rc2 it doesnt update the gui

Image
Azaezel
Posts: 383
Joined: Tue Feb 03, 2015 9:50 pm
 
by Azaezel » Tue Mar 21, 2017 2:25 am
OK, will try and dig on that some time this week.
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Mar 21, 2017 3:04 am
okay this has me stumped, i copied all files that were changed into my code. the only file presenting a problem is guiCanvas.cpp

says cannot convert from const S32 to GuiControl

something must have been changed in gui canvas, im going to check the history of the file and see what changed
marauder2k9
Posts: 138
Joined: Wed Feb 18, 2015 7:36 am
by marauder2k9 » Tue Mar 21, 2017 3:35 am
okay changed

Code: Select all

DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (NULL), "(GuiControl ctrl=NULL)"


to

Code: Select all

DefineConsoleMethod( GuiCanvas, popDialog, void, (GuiControl * gui), (nullAsType<GuiControl*>()), "(GuiControl ctrl=NULL)"


builds now, but still no update to the gui
38 posts Page 3 of 4

Who is online

Users browsing this forum: No registered users and 1 guest