Game Development Community

Initial MessageHud Position

by Jeremy Alessi · in Torque Game Engine · 02/05/2006 (12:55 pm) · 1 replies

I have my MainChatHud centered up top on screen. I have also adjusted the code in MessageHud.cs so the MessageHud GUI element is centered and positioned directly under the MainChatHud element. It works fine whenever I press "u" to chat ... but only AFTER the first time.

The very first time I press "u" to chat the MessageHud gets offset down and to the right of the MainChatHud. I can't seem to find the place that would control this. I'm looking at the chatHud.gui file ... but nothing seems to help the MessageHud pop up where it should the first time it is invoked.

#1
02/05/2006 (11:06 pm)
OK, here's what worked:

Create the MessageHud GUI element after the MainChatHud element. Then set the MessageHud_Frame position field to:

position = FirstWord( OuterChatHud.position ) SPC ( getWord( OuterChatHud.extent, 1 ) + "1" );

Then in messageHud.cs change the MessageHud::open method so the window position and extents are:

%windowPos = FirstWord( MessageHud_Frame.position ) SPC getWord( MessageHud_Frame.position, 1 );
%windowExt = FirstWord( MessageHud_Frame.extent ) SPC getWord( MessageHud_Frame.extent, 1 );

It seems that getting the position and extent from the OuterChatHud ... just inside this open method causes the offset ... like it's done twice or something. I am also using relative for these elements.