TGB/Tutorials/Fill Battle/The Engine That Could
From TDN
[edit] Engine TipI considered myself highly proficient in C++ when I first looked at the TGE in 2001. I'm still finding out cool things the engine can do. When looking at the code, remember these two things:
[edit] The Engine That CouldRun Visual C++ 2008 Express Edition. File -> Open Project/Solution... Browse to c:\Torque2D\FillBattle\engine\compilers\VisualStudio 2008. Rename T2D SDK.sln to FillBattle.sln. Open FillBattle.sln. "TorqueGameBuilder" will be bolded in the "Solution Explorer" (typically on the left) to show it as the main project. Right click on "TGBGame" and select "Set as StartUp Project". Now, if you need to debug, this will be the main project. At the top of the screen you’ll see "Debug". Change this to "Release". These are configurations set up by Garage Games. Unless you run into a bug, you’ll always use "Release". Browse the menus to Build -> Build Solution. This will take a while, but it’s re-building the entire engine. After it’s done, look in your tgb directory. You’ll see that TorqueGameBuilder.exe has the current date and time. Success! Unfortunately, the game is in tgb/gameData/T2DProject as TGBGame.exe. To automatically get this into your game, let’s add a post-built step: Right-click on TGBGame in the "Solution Explorer" and select "Properties". Expand to Configuration Properties -> Build Events -> Post-Build Event. In Command Line, click the little "..." and type in the following as a single line: copy c:\Torque2D\FillBattle\tgb\gameData\T2DProject\TGBGame.exe c:\Torque2D\FillBattle\games\FillBattle\FillBattle.exe NOTE: Remember to use your paths. Because the post-build event doesn’t force anything to re-build, we need to do something just this once. Under TGBGame, open the folder "game" and the file "main.cc". Erase any character and replace it. Build -> Build Solution. Now, if you go to FillBattle\games\FillBattle, you’ll see the new executable with the current date and time. The copy was a success!
[edit] Your Biggest FriendThe find-in-files search will be your biggest friend. Ctrl-Shift-F. Abuse it. Change the "Look in:" to be "Current Project". Try searching for "t2dVectorAdd" and double-click on the search result for the ConsoleFunction. You may not understand the magic there now, but you will very soon!
[edit] Complete! |



