Game Development Community

dev|Pro Game Development Curriculum

T2D Primitives for T2D/TGB RC3

by Matthew "Ashteth" Kee · 01/18/2006 (5:14 pm) · 8 comments

Download Code File

Note: This version is for Torque 2D 1.1 Alpha. Package has been updated to include a Line Strip object. I am currently using a custom version of Torque2D alpha, so this has *not* been tested with the stock version of 1.1 alpha. If you have any problems, please e-mail me (address in profile).

Includes the following files:

t2dDraw - A C++ only singleton that does all the actual drawing. Using this class
allows common drawing routines to be shared.
Status: 80% complete

t2dRoundedQuad - A rectangle in which the four corners may be toggled into rounded circles.
There is no gradient effect for this class. The outline may optionally be displayed
in a different colour.
Status: Complete

t2dQuad - A rectangle. May be rendered as a solid colour or blended with each corner
assigned a seperate color. A border may optionally be displayed. The border has
its own colour settings.
Status: Complete

t2dTriangle - A triangle. May be rendered as a solid colour or blended with each of
the three vertices using a seperate colour. Triangle vertices may be assigned to
any of the four corners of the t2dSceneObject bounding box. They may also be assigned
to positions half way between any two adjacent points on the bounding box's outer
parameter. In other words, you have 8 points to chose from to assign vertices to.
A border may optionally be displayed. The border has its own colour settings.
Status: Complete


t2dEllipse - A disk / circle / ellipse rendering class. May be rendered as a solid
or blended with an inner and outer colour. The ellipse is automatically sized
to the size of the t2dSceneObject bounding box. Optionally, an inner radius
may be assigned. The width of the inner radius will not be rendered.
Currenty if an inner radius is assigned, the ellipse displays as a circle with
its radius as the smaller of the width/height of the bounding box. This was done to
make life simpler for the programmer, but eventually should be changed.
Status: 90% complete

t2dProgressBar - A quad in which the bounding box is filled a percent of completion (from zero to 1).
Status: 90% complete

t2dArc - Render a portion (or all) of a circle with an inner and outer radius.
May be rendered as a solid colour or blended with an inner and outer colour.
Status: 90% complete

t2dPolygon - An Arbitrary set of points that may be rendered with an optional border.
Status: 25% complete

t2dLineStrip - A line strip of 1 or more points. May be solid coloured or blended.
Status: 75% complete

#1
01/19/2006 (10:31 pm)
Very cool Matthew! We put a simple t2dShapeVector in the new Alpha3 of T2D 1.1 as well. :) Let us know what you think in the forums!
#2
02/02/2006 (12:28 pm)
I used the fxText in the orginal version quite a bit. Unfortunatly it dosn't appear in the lastest version.

Also, as the T2DDatablockID's have been deprieciated , any chance of an update(C++ noob...)?
#3
06/18/2006 (5:37 pm)
I have updated this resource to make it compatible with the latest version of T2D/TGB (currently release candidate 3). No T2D code modification is neccessary, just plug in and recompile :)
#4
06/18/2006 (10:02 pm)
Hmm, I don't have (RC3) t2dClipRect.h ?
#5
06/20/2006 (7:09 am)
Sorry, the missing .h file was legacy (doesn't actually do anything). I have updated the resource.
#6
07/14/2006 (11:09 am)
Very good, Matthew
#7
10/03/2006 (12:53 pm)
Do these work with TGB v1.1.2?

I'd like to draw some simple circles (and possibly other primitives)

[EDIT] Oh, and does this work with the collision detection stuff already built-in to TGB?
#8
12/11/2006 (9:38 am)
Not supported anymore for TGB v1.1.3 ?
It's an important missing features.