Game Development Community

Drawing Border Ring

by Zane · in Technical Issues · 05/21/2007 (3:50 pm) · 4 replies

I am working on a rts game and I want to draw ring around the base which shows the border of where the player can build. The rts kit already draws rings around units and buildings, but I need the border ring to be drawn all the time, and to be changeable through scripting. I have looked at the source, but I've only been using Torque for a while now, and I'm not sure what to change to achieve this feature.

About the author

Recent Threads


#1
05/22/2007 (5:35 am)
Zane - The selection rings in the RTS pack are drawn as part of the terrain rendering, the texture used is hardcoded into the terrain/terrData.cc module at around line 801:
mSelectionTexture = TextureHandle("starter.RTS/client/ui/ring_white", BitmapTexture, true);

and actually drawn as part of terrain/terrRender.cc at around line 2357 look for:
//selections...
   if (sgCurrSelectionTris) {

Lastly the other place you may want to look at is the customized Gui element used for RTS pack for viewing the world, handling mouse input and what draws the damage bars for selected units so you could tie in your drawing as part of this, look at the GuiRTSTSCtrl::onRender function (around line 337) in game/RTS/guiRTSTSCtrl.cc at around line

I can't post any more info/code extracts than this as it's a public forum, you'd be best posting queries about the RTS start kit in their own forums www.garagegames.com/mg/forums/result.forum.php?qf=140&qff=t&qps=50&qua=0&qpg=2
#2
05/22/2007 (5:39 am)
Thanks, that's really helpful. I was just wondering about one more thing. Can you get a global variable from the script into the engine, and how would that be done?
#3
05/22/2007 (6:33 am)
Zane - you sure can by using the Con::getVariable function defined in console/console.h, for example:
myvar = Con::getVariable("$pref::Video::resolution");
#4
05/22/2007 (6:38 am)
Thanks, that's just what I needed.