Game Development Community

guigraphctrl..does it exist?

by Andrew13 · in Torque Game Engine Advanced · 04/05/2009 (10:52 pm) · 9 replies

Does Guigraphctrl exist in TGEA 1.8.1 ?

I need to do a graph GUI element. Search is not being kind. I can seem some references but not much more .

Anyone point me in the right direction ?

#1
04/05/2009 (11:17 pm)
I never noticed that the netGraph toggle didn't work in TGEa until now, but the Ctrl does appear to be there, even though nothing seems to make use of it anymore:

"~/engine/source/gui/editor/guiGraphCtrl.h"
"~/engine/source/gui/editor/guiGraphCtrl.cpp"
#2
04/05/2009 (11:23 pm)
... and a quick test shows that the netGraph GUI from TGE 1.5.2 works in TGEa 1.8.1, so yeah it exists.
#3
04/06/2009 (4:54 pm)
How might i get the netgraph from 1.5.2 ?

Does GG allow us to Download older version ?


Thanks for the pointer

#4
04/06/2009 (9:56 pm)
I think that TGEa owners can get TGE now at no charge, hmm, not sure how that works but you would have to ask I would think.
#5
04/06/2009 (9:59 pm)
Ah hell, it's just a script file for one little gui:
These are the needed Profiles and the NetGraphGUI itself
// Profiles
new GuiControlProfile (NetGraphGhostsActiveProfile)
{
   fontColor = "255 255 255";
};
new GuiControlProfile (NetGraphGhostUpdatesProfile)
{
   fontColor = "255 0 0";
};
new GuiControlProfile (NetGraphBitsSentProfile)
{
   fontColor = "0 255 0";
};
new GuiControlProfile (NetGraphBitsReceivedProfile)
{
   fontColor = "0 0 255";
};
new GuiControlProfile (NetGraphLatencyProfile)
{
   fontColor = "0 255 255";
};
new GuiControlProfile (NetGraphPacketLossProfile)
{
   fontColor = "0 0 0";
};

//--- OBJECT WRITE BEGIN ---
new GuiControl(NetGraphGui) {
   profile = "GuiDefaultProfile";
   horizSizing = "left";
   vertSizing = "bottom";
   position = "0 0";
   extent = "640 480";
   minExtent = "8 2";
   visible = "1";
   noCursor = "1";
   
   new GuiGraphCtrl(NetGraph) {
      profile = "GuiDefaultProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "432 5";
      extent = "200 200";
      minExtent = "8 2";
      visible = "1";
    };

   new GuiTextCtrl(Latency) {
      profile = "NetGraphLatencyProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "436 184";
      extent = "100 18";
      minExtent = "8 2";
      visible = "1";
      text = "Latency";
      maxLength = "255";
   };
   new GuiTextCtrl(PacketLoss) {
      profile = "GuiTextProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "536 184";
      extent = "59 18";
      minExtent = "8 2";
      visible = "1";
      text = "Packet Loss";
      maxLength = "255";
   };
   new GuiTextCtrl(BitsReceived) {
      profile = "NetGraphBitsReceivedProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "536 170";
      extent = "100 18";
      minExtent = "8 2";
      visible = "1";
      text = "Bits Received";
      maxLength = "255";
   };
   new GuiTextCtrl(GhostsActive) {
      profile = "NetGraphGhostsActiveProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "436 156";
      extent = "100 18";
      minExtent = "8 2";
      visible = "1";
      text = "Ghosts Active";
      maxLength = "255";
   };
   new GuiTextCtrl(GhostUpdates) {
      profile = "NetGraphGhostUpdatesProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "536 156";
      extent = "100 18";
      minExtent = "8 2";
      visible = "1";
      text = "Ghost Updates";
      maxLength = "255";
   };
   new GuiTextCtrl(BitsSent) {
      profile = "NetGraphBitsSentProfile";
      horizSizing = "left";
      vertSizing = "bottom";
      position = "436 170";
      extent = "100 18";
      minExtent = "8 2";
      visible = "1";
      text = "Bits Sent";
      maxLength = "255";
   };
};
//--- OBJECT WRITE END ---
#6
04/06/2009 (10:01 pm)
And the accompanying functions that make it work
function NetGraph::toggleNetGraph()
{
    if(!$NetGraph::isInitialized)
    {
        $Stats::netGhostUpdates = 0;
        NetGraph::updateStats();
        $NetGraph::isInitialized = true;
    }

    if(!Canvas.isMember(NetGraphGui))
    {
        Canvas.add(NetGraphGui);
    }
    else
      Canvas.remove(NetGraphGui);
}

function NetGraph::updateStats()
{
  $NetGraphThread = NetGraph.schedule(32, "updateStats");

  if(!$Stats::netGhostUpdates)
     return;

  if(isobject(NetGraph))
  {
    if(isobject(ServerConnection))
        NetGraph.addDatum(0,ServerConnection.getGhostsActive());
    GhostsActive.setText("Ghosts Active: " @ ServerConnection.getGhostsActive());
    NetGraph.addDatum(1,$Stats::netGhostUpdates);
    GhostUpdates.setText("Ghost Updates: " @ $Stats::netGhostUpdates);
    $Stats::netGhostUpdates = 0;
    NetGraph.addDatum(2,$Stats::netBitsSent);
    BitsSent.setText("Bits Sent: " @ $Stats::netBitsSent);
    NetGraph.addDatum(3,$Stats::netBitsReceived);
    BitsReceived.setText("Bits Received: " @ $Stats::netBitsReceived);
    NetGraph.matchScale(2,3);
    NetGraph.addDatum(4,ServerConnection.getPing());
    Latency.setText("Latency: " @ ServerConnection.getPing());
    NetGraph.addDatum(5,ServerConnection.getPacketLoss());
    PacketLoss.setText("Packet Loss: " @ ServerConnection.getPacketLoss());
  }
}

function NetGraph::toggleKey()
{
  if(!GhostsActive.visible)
  {
    GhostsActive.visible = 1;
    GhostUpdates.visible = 1;
    BitsSent.visible = 1;
    BitsReceived.visible = 1;
    Latency.visible = 1;
    PacketLoss.visible = 1;
  }
  else
  {
    GhostsActive.visible = 0;
    GhostUpdates.visible = 0;
    BitsSent.visible = 0;
    BitsReceived.visible = 0;
    Latency.visible = 0;
    PacketLoss.visible = 0;
  }
}

#7
04/06/2009 (10:04 pm)
NetGraphGui.gui was found in the common/ui directory. I don't suppose it really matters where you place it, just so long as it get's exec'd. The keybind for it still exists in your default.bind.cs.
#8
04/07/2009 (5:17 pm)
Thanks very much

I will try it out and see what i can get it to do
#9
04/07/2009 (5:30 pm)
Is it just me, or are the necessary functions missing that make it work - post #6?

I can see them when I try editing that post but for some reason they don't show up - might be something to do with the recent site update today.

EDIT: ah, it was the latest set of changes to the website that caused it -- all fixed now!