Game Development Community

Porting Keyboard Shortcuts Back to 1.7.8

by Orion the Hunter · in Torque Game Builder · 06/12/2013 (8:39 am) · 8 replies

Hello, everyone!

I'm sure I'm not the only one who's noticed the amount of Mac keyboard shortcuts—or the lack thereof. Thus, will someone please point me to the right file in 1.7.6's source that has them? I've tried looking through the main *.nib file but no luck except for a very baseline menu bar.

Thanks!

#1
06/12/2013 (9:04 am)
Keyboard shortcuts are just binds. They're in script. Search your scripts for bind and bindCmd....
#2
06/12/2013 (3:47 pm)
You do that to make binds for the engine? Really? Because, I know that the engine source is C++ and that the game source is TorqueScript, so the two wouldn't work together. I'm trying to figure out where in T2D 1.7.6's source the keybinds for the editor are stored so I can copy them over to the same file in T2D 1.8's source.
#3
06/12/2013 (5:17 pm)
If you're talking about the shortcuts for the editor, then really:

C:Torque2D_1_8/tgb/tools/main.cs(31):         levelEditorMap.bind(keyboard, "lbracket", layerSelectionDown, "Move Selection One Layer Closer To Camera");
C:Torque2D_1_8/tgb/tools/main.cs(32):         levelEditorMap.bind(keyboard, "rbracket", layerSelectionUp, "Move Selection One Layer Away From Camera");
C:Torque2D_1_8/tgb/tools/main.cs(34):         levelEditorMap.bind(keyboard, "escape", levelBuilderSetSelectionTool, "Activate the Selection Tool");
C:Torque2D_1_8/tgb/tools/main.cs(36):         levelEditorMap.bind(keyboard, "e", levelBuilderSetEditPanel, "Show the Edit Panel");
C:Torque2D_1_8/tgb/tools/main.cs(37):         levelEditorMap.bind(keyboard, "c", levelBuilderSetCreatePanel, "Show the Create Panel");
C:Torque2D_1_8/tgb/tools/main.cs(38):         levelEditorMap.bind(keyboard, "p", levelBuilderSetProjectPanel, "Show the Project Panel");
C:Torque2D_1_8/tgb/tools/main.cs(40):         levelEditorMap.bind(keyboard, "home", levelBuilderHomeView, "Home the View");
C:Torque2D_1_8/tgb/tools/main.cs(41):         levelEditorMap.bind(keyboard, "end", levelBuilderZoomToFit, "Show All Scene Contents");
C:Torque2D_1_8/tgb/tools/main.cs(42):         levelEditorMap.bind(keyboard, "equals", levelBuilderZoomViewIn, "Zoom the View Window In");
C:Torque2D_1_8/tgb/tools/main.cs(43):         levelEditorMap.bind(keyboard, "minus", levelBuilderZoomViewOut, "Zoom the View Window Out");
C:Torque2D_1_8/tgb/tools/main.cs(44):         levelEditorMap.bind(keyboard, "left", levelBuilderViewLeft, "Move the View Window Left");
C:Torque2D_1_8/tgb/tools/main.cs(45):         levelEditorMap.bind(keyboard, "right", levelBuilderViewRight, "Move the View Window Right");
C:Torque2D_1_8/tgb/tools/main.cs(46):         levelEditorMap.bind(keyboard, "up", levelBuilderViewUp, "Move the View Window Up");
C:Torque2D_1_8/tgb/tools/main.cs(47):         levelEditorMap.bind(keyboard, "down", levelBuilderViewDown, "Move the View Window Down");
C:Torque2D_1_8/tgb/tools/main.cs(52):            levelEditorMap.bind(keyboard, "cmd z",       levelBuilderUndo, "Undo The Last Action");
C:Torque2D_1_8/tgb/tools/main.cs(53):            levelEditorMap.bind(keyboard, "cmd-shift z", levelBuilderRedo, "Redo an Undone Action");
C:Torque2D_1_8/tgb/tools/main.cs(54):            levelEditorMap.bind(keyboard, "cmd c",       levelBuilderCopy, "Copy the Selected Objects");
C:Torque2D_1_8/tgb/tools/main.cs(55):            levelEditorMap.bind(keyboard, "cmd x",       levelBuilderCut, "Cut the Selected Objects");
C:Torque2D_1_8/tgb/tools/main.cs(56):            levelEditorMap.bind(keyboard, "cmd v",       levelBuilderPaste, "Paste Cut or Copied Objects");
C:Torque2D_1_8/tgb/tools/main.cs(60):            levelEditorMap.bind(keyboard, "ctrl z", levelBuilderUndo, "Undo The Last Action");
C:Torque2D_1_8/tgb/tools/main.cs(61):            levelEditorMap.bind(keyboard, "ctrl y", levelBuilderRedo, "Redo an Undone Action");
C:Torque2D_1_8/tgb/tools/main.cs(62):            levelEditorMap.bind(keyboard, "ctrl c", levelBuilderCopy, "Copy the Selected Objects");
C:Torque2D_1_8/tgb/tools/main.cs(63):            levelEditorMap.bind(keyboard, "ctrl x", levelBuilderCut, "Cut the Selected Objects");
C:Torque2D_1_8/tgb/tools/main.cs(64):            levelEditorMap.bind(keyboard, "ctrl v", levelBuilderPaste, "Paste Cut or Copied Objects");

There are most of your editor keybinds. You have to look in the editor project.
#4
06/12/2013 (5:18 pm)
For the record, the TGB editor is just a modified game....
#5
06/13/2013 (10:53 am)
Hm... that's interesting. So, what would be the command for saving a file and opening one?
#6
06/13/2013 (7:31 pm)
Saving a file and opening one for what? There is a long, complex process for opening and loading a level, for instance. From tgb/tools/editorClasses/gui/tgbStartPage.ed.cs:
function TGBWorkspace::openProject( %this )
{
   %dlg = new OpenFileDialog()
   {
      Title = "Open Project";
      DefaultPath = $Pref::Dialogs::LastProjectPath;
      Filters = "T2D Projects (*.t2dproj)|*.t2dproj|All Files (*.*)|*.*";
      MustExist = true;
      MultipleFiles = false;
      ChangePath = false;
   };
   
   if(%dlg.Execute())
   {
      $Pref::Dialogs::LastProjectPath = filePath( %dlg.FileName );
      if(! LBProjectObj.isActive())
         Projects::GetEventManager().postEvent( "_ProjectOpen", %dlg.FileName );
      else 
      {
         $pref::startupProject = %dlg.FileName;
         reloadProject();
      }
   }

}

I know you don't use Torsion because you work on a <cringe> Mac. I don't know what to tell you. It is so much easier when you can search the project for the functionality you need. Perhaps a real computer would help.... ;p
#7
06/14/2013 (11:04 am)
Or a "real" version of Torsion... XD

Well, this Mac can use Bootcamp and I do have a copy of Windows XP... maybe I could use that?
#8
06/14/2013 (11:55 am)
Sure, the scripts are the same either way. Really, you could probably just use the file manager (er, whatever that's called) to search the file contents for you. But Torsion would also allow you to test and debug your game under Windows, not just search. If the engine source doesn't change then it should work on both platforms.

If I owned Torsion (as in, owned the source/IP) I'd seriously consider porting it to Mac - just because of the number of people who would get good use out of it.