Game Development Community

GUI Builder resolutions [solved]

by Max Kielland · in Torque Game Builder · 01/21/2013 (12:44 pm) · 8 replies

My game will run in 1280 x 1024 as default resolution. The GUI Builder can only select up to 1024 x 768 resolution. I tried to override this by setting the Extent field to 1280 1024. But when I run my game it is set back to 1024 x 768.

I have the Pro version and I have tried to find the place where I can add more resolutions to the GUI Builder resolution list...

Can you please point me in the right direction?
My thought was to recompile TGB so I have some more resolutions available.

#1
01/21/2013 (2:08 pm)
I'm not 100% positive this is the correct answer, but I don't believe you will have to change any source code to make this change, but you will need to make a few changes to 1 file in particular.

Located at the following location: TGB Install Dir\tgb\tools\guiEditor\gui\guiEditor.ed.cs

Here around line 400 is where you will have to start your changes:
GuiEditorResList.add("640 x 480", 640);
GuiEditorResList.add("800 x 600", 800);
GuiEditorResList.add("1024 x 768", 1024);
GuiEditorResList.add("1280 x 1024", 1280);

Then add in the case for 1280 in the switch statement shortly below:
case 1024:
         GuiEditorResList.setText("1024 x 768");
case 1280:
         GuiEditorResList.setText("1280 x 1024");

And again, a bit more below in the function GuiEditorResList::onSelect
case 1024:
         GuiEditorRegion.resize(0,0,1024,768);
         GuiEditorContent.getObject(0).resize(0,0,1024,768);
         $Pref::GuiEditor::PreviewResolution = "1024 768";
case 1280:
         GuiEditorRegion.resize(0,0,1280,1024);
         GuiEditorContent.getObject(0).resize(0,0,1280,1024);
         $Pref::GuiEditor::PreviewResolution = "1280 1024";

I believe that should allow you to do what you need.

#2
01/22/2013 (8:19 am)
This worked, thanks! But actually it looks like with TGB 1.7.6 your last step isn't needed since mine looks like this:
function GuiEditorResList::onSelect(%this, %id)
{
   //Instead of recreating the item's resolution by switch(%id), just
   //grab the text by the id, and use the actual values, this way, we
   //can add in new values, enter the info once, then just grab it when
   //we need it.
  %text = GuiEditorResList.getTextById( %id ); 
  %width = getWord( %text, 0 );
  %height = getWord( %text, 2);//text 1 is the x between the values
  %preview = %width SPC %height;
  GuiEditorRegion.resize(0,0,%width,%height);
  GuiEditorContent.getObject(0).resize(0,0,%width,%height);
  $Pref::GuiEditor::PreviewResolution = %preview;
}
#3
01/22/2013 (8:41 am)
I did the the changes and as I also have TGB 1.7.6, the last part isn't needed. But it doesn't work for me.

I have tried my current and a brand new project. I still only get 1024 x 768 as the highest resolution in the GUI Builder.

I tried to remark all resolutions except one, but I still get all of them in the list. It feels like I'm editing the wrong file.

To be sure that the scripts are recompiled I deleted all the .EDSO files and I can see in the log that they are compiled. But it still behaves as it was never changed.

Do I need to copy and update some files, or is it just supposed to work?

@Chris What system do you use? I'm running Windows 7 x64.
#4
01/22/2013 (6:42 pm)
I'm running Windows 7 x64 as well. There shouldn't be anything to recompile and I didn't even clear my old .edso files to get it to work. Are you sure you're making this change in the working directory of TGB and not a backup or some other install location?

And here's the full altered bits of the changed function after I made my updates:
//----------------------------------------
function GuiEditorOpen(%content)
{
   ...
   
   activatePackage(GuiEditor_BlockDialogs);
   GuiEditorContent.add(%content);
   deactivatePackage(GuiEditor_BlockDialogs);
   GuiEditorContentList.sort();

   GuiEditorResList.clear();
   GuiEditorResList.add("320 x 480", 320);
   GuiEditorResList.add("480 x 320", 480);
   GuiEditorResList.add("640 x 480", 640);
   GuiEditorResList.add("800 x 600", 800);
   GuiEditorResList.add("1024 x 768", 1024);
   GuiEditorResList.add("1280 x 1024", 1280);
   GuiEditorResList.add("1366 x 768", 1366);
   GuiEditorResList.add("1600 x 900", 1600);
   GuiEditorResList.add("1680 x 1050", 1680);
   GuiEditorResList.add("1920 x 1080", 1920);
   %ext = $Pref::GuiEditor::PreviewResolution;
   if( %ext $= "" )
   {
      %ext = GuiEditorRegion.getExtent();
      echo("extent is " @ %ext );
      switch(getWord(%ext, 0))
      {
         case 320:
            GuiEditorResList.setText("320 x 480");
         case 480:
            GuiEditorResList.setText("480 x 320");
         case 640:
            GuiEditorResList.setText("640 x 480");
         case 800:
            GuiEditorResList.setText("800 x 600");
         case 1024:
            GuiEditorResList.setText("1024 x 768");
	 case 1280:
            GuiEditorResList.setText("1280 x 1024");
	 case 1366:
            GuiEditorResList.setText("1366 x 768");
	 case 1600:
            GuiEditorResList.setText("1600 x 900");
	 case 1680:
            GuiEditorResList.setText("1680 x 1050");
	 case 1920:
            GuiEditorResList.setText("1920 x 1080");
      }
   }
   else
   {
      ...
}

After making that change and saving the file yeah it just worked.
#5
01/22/2013 (9:10 pm)
Clean .dso's just in case.....
#6
01/23/2013 (8:07 am)
@Richard I did delete all teh .dso files and made sure they got compiled whrn I started TGB again. But still no difference.

@Chris Yes, that is the same code I ended up with.

I will do an uninstall and then reinstall everything again. Maybe it fixes the problem... I will keep you updated...
#7
01/23/2013 (10:30 am)
Okay I uninstalled and reinstalled. Now it works!

@Doc308
Thanks for your guidance, it works fine now :)
#8
01/23/2013 (10:31 am)
Nice! Glad you got it working.