Game Development Community

GuiObjectSelectionHud (TGEA)

by Matt Huston · 07/06/2007 (5:35 pm) · 4 comments

Download Code File

Tested with TGEA 1.01

Overview

Object selection similar to Deus Ex, System Shock and other Action-RPGs. A outline rectangle is drawn and the objects name is printed at the top right corner. To add new objects, check the ObjectMask but remember you will need to make sure the object type being added has its own CastRay function or it won't be picked up. ItemObjectType for instance doesn't have one so you will need to add it yourself.

Add guiObjectSelectionHud.cpp to your project in the engine/game/fps directory.

Compile!

Add the following to the bottom of you playGui.gui.

new GuiObjectSelectionHud() {
      canSaveDynamicFields = "0";
      Profile = "GuiDefaultProfile";
      HorizSizing = "relative";
      VertSizing = "relative";
      Position = "0 0";
      Extent = "640 480";
      MinExtent = "8 2";
      canSave = "1";
      Visible = "1";
      hovertime = "1000";
      TextColor = "1 1 1 1";
      TextOutlineColor = "1 1 1 1";
      TextFillColor = "0.3 0.3 0.3 0.75";
      OutlineColor = "1 1 1 1";
      Offset = "10";
   };

OutlineColor - Object selection rectangle color.
TextColor - Object names text color.
TextOutlineColor - Text rectangles outline color.
iTextFillColor - Rectangle behind texts fill color.
Offset - Offset from the objects bounding box to the actual rectangle.

#1
07/07/2007 (6:19 am)
this one is very interesing.. thanks for sharing. Do you care if I'll try to make the TGE version of it (+resource)?
#2
07/07/2007 (12:48 pm)
@bank

Go right ahead, you can send me your code and I can put it up in the main body of the resource.
#3
10/10/2007 (2:02 pm)
Can u explain how to add ItemObjectType?
#4
12/11/2007 (3:58 pm)
@Taras

Add castRay from the player.cpp to item.cpp, renaming its function definition to Item::castRay.