GuiAnimatedCrosshairHud (TGEA)
by Matt Huston · 07/06/2007 (5:35 pm) · 7 comments
Download Code File
Tested with TGEA 1.01
Overview
Animated crosshair thats reticle scales based on player movement and if the player is aiming at an enemy. The scaling is based on how much the camera is moving (whether just looking around or actual player movement) and also what the player is aiming at. To edit values for this, check the advanceTime function. To add new objects to aim at, check the ObjectMask but remember you will need to make sure the object being added has its own CastRay function.
Add guiAnimatedCrosshairHud.cpp to your project in the engine/game/fps directory.
In guiBitmapCtrl.h, add virtual to the setBitmap function declarations.
Compile!
Add the weapon_crosshair.png and weapon_reticle.png to starter.fps/client/ui
Replace the GuiCrossHairHud in playGui.gui with the following.
Tested with TGEA 1.01
Overview
Animated crosshair thats reticle scales based on player movement and if the player is aiming at an enemy. The scaling is based on how much the camera is moving (whether just looking around or actual player movement) and also what the player is aiming at. To edit values for this, check the advanceTime function. To add new objects to aim at, check the ObjectMask but remember you will need to make sure the object being added has its own CastRay function.
Add guiAnimatedCrosshairHud.cpp to your project in the engine/game/fps directory.
In guiBitmapCtrl.h, add virtual to the setBitmap function declarations.
virtual void setBitmap(const char *name, bool resize = false); virtual void setBitmap(GFXTexHandle handle, bool resize = false);
Compile!
Add the weapon_crosshair.png and weapon_reticle.png to starter.fps/client/ui
Replace the GuiCrossHairHud in playGui.gui with the following.
new GuiAnimatedCrosshairHud(Crosshair) {
canSaveDynamicFields = "0";
Profile = "GuiDefaultProfile";
HorizSizing = "relative";
VertSizing = "relative";
Position = "255 175";
Extent = "128 128";
MinExtent = "8 2";
canSave = "1";
Visible = "1";
hovertime = "1000";
bitmap = "./weapon";
};About the author
www.atomicbanzai.com
#2
09/18/2007 (8:05 am)
Is there a resource like this for TGE? Good job!
#4
Any ideas what I could be doing wrong?
3>c:\torque\tgea_1_0_3\engine\gui\controls\guibitmapctrl.cpp(22) : error C2039: 'setBitmapName' : is not a member of 'GuiBitmapCtrl'
3> c:\torque\tgea_1_0_3\engine\gui\controls\guibitmapctrl.h(14) : see declaration of 'GuiBitmapCtrl'
01/13/2008 (6:37 pm)
I am getting this error when building, after making these changes. Any ideas what I could be doing wrong?
3>c:\torque\tgea_1_0_3\engine\gui\controls\guibitmapctrl.cpp(22) : error C2039: 'setBitmapName' : is not a member of 'GuiBitmapCtrl'
3> c:\torque\tgea_1_0_3\engine\gui\controls\guibitmapctrl.h(14) : see declaration of 'GuiBitmapCtrl'

Torque 3D Owner Henry Garle
You even stuck in crosshair changing, saved me alot of work.