Game Development Community

Adding Examples of API Usage to TGB Reference?

by Keith Johnston · in Torque Game Engine · 09/03/2006 (6:46 pm) · 1 replies

As I've been digging through the TGB documentation, I found myself thinking it would be really nice if some of APIs had a short example showing its usage.

For example, the getCurrentCameraArea() returns a Rectangle. It took me a while to track down how to actually get the x,y coords for the top left and bottom left corners of the rectangle. A simple example in the docs for this method might look like this:

%area = sceneWindow2D.getCurrentCameraArea();
	%newLeft=getWord(%area,0)+%dx;
	%newTop=getWord(%area,1)+%dy;
	%newRight=getWord(%area,2)+%dx;
	%newBottom=getWord(%area,3)+%dy;
	sceneWindow2D.setCurrentCameraArea(%newLeft,%newTop,%newRight,%newBottom);

If no one has any objections, I could start adding these as I use the APIs.

This is the doc I'm referring to
http://tdn.garagegames.com/wiki/TGB/Reference

#1
03/01/2007 (9:44 am)
@Keith: great idea. I'm doing this, too, with the blessings of GG. See my blog.

There's a lot to do. Not to get discouraged. One small step at a time.