Game Development Community

C++ Function Implementation

by Todd Johnson · in Torque Game Engine · 12/06/2004 (2:24 pm) · 3 replies

Ok, I just want to be able to see the object name over an item (not jus a player). But I have to have something enabled in order to see these names. This is what I got so far...

GuiShapeNameHud
if(control->getScanMode() || shape->getType() & PlayerObjectType)
{
   // Render the shape's name
  drawName(Point2I((S32)projPnt.x,  (S32)projPnt.y),shape->getShapeName(),opacity);
}

ShapeBase
...mScanItems = false;

void ShapeBase::setScanMode(bool blnScan)
{
	mScanItems = blnScan;
}

bool ShapeBase::getScanMode()
{
	return mScanItems;
}

ConsoleMethod(ShapeBase,setScanMode,void,3, 3,"(boolean)Turns on/off the ability to see module contents")
{
   object->setScanMode(dAtof(argv[2]));
}

ConsoleMethod(ShapeBase,getScanMode,bool,2, 2,"Checks your scanning ability")
{
   return object->getScanMode();
}

In the game I can do Player.setScanMode(1) and turn on my scan mode. From here I should see names on items right? Well I don't and if I do echo(Player.getScanMode); I can see that it was set to true. Of course I can remove control->getScanMode() from the top if (then I see the item names) but I need to be able to turn this on or off. I guess my problem is that control->getScanMode() is always returning false. Anyone know why? Thanks.

#1
12/07/2004 (9:01 pm)
Are you making sure that you're propagating your info across the network?
#2
12/08/2004 (3:43 am)
Thank you! That's what my problem has been in all of my coding thus far. How would I do that in this example?
#3
12/08/2004 (9:03 am)
I'd suggest reading the NetObject documentation in the engine reference.