Game Development Community

Tutorial loses mouse connection on PlayGui change

by W. Wood Harter · in Torque Game Engine · 02/27/2007 (11:09 am) · 1 replies

I had a problem where the mouse connection was lost in the tutorial after adding the Score element to the PlayGuil. On further investigation and much searching on GG forums I ended up having to figure it out on my own. I'm posting this for others.

I figured this out by looking at gui files in a text editor. I took a non-working playGui and removed all the score information with the gui editor and tried it again. It still didn't work and the mouse would not control the view. I opened the original tutorial.base playGui and compared the two. I found a few differences, but the following item was the key.

noCursor = "1";

I added that to the root object and it worked again on the next reload. I went back to my previous version with the score elements and added the noCursor = "1" to the root item (GameTSCtrl(PlayGui)) and it worked while showing the score. Here is part of the playgui.gui file.

new GameTSCtrl(PlayGui) {
    canSaveDynamicFields = "0";
    Profile = "GuiContentProfile";
    HorizSizing = "right";
    VertSizing = "bottom";
    position = "0 0";
    Extent = "800 600";
    MinExtent = "8 8";
    canSave = "1";
    Visible = "1";
    hovertime = "1000";
    applyFilterToChildren = "1";
    cameraZRot = "0";
    forceFOV = "0";
    [b]noCursor = "1";[/b]
      new GuiControl() {
          canSaveDynamicFields = "0";
          Profile = "GuiWindowProfile";
          ...
          ...

It doesn't look like noCursor is available from inside the gui editor so you'll have to add this using a text editor. In general, I don't think adding the hud elements directly is the correct solution since you should be creating them as separate gui elements and using script to push them onto the display. This is a good overview of the proper process.

www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2221

Good luck,
Wood

#1
02/27/2007 (2:48 pm)
CanSaveDynamicFields = "0"; change this to canSaveDynamicFields = "1";

otherwise every time you change playgui in game it will lose the mouse..

TomFeni