First, you'll need to download some tools. Here they are:
- Komodo Edit, which is a free development environment for write source code. It will be our development environment for making games and applications using BennuGD. Here's the download page; the link is at the bottom. Komodo Edit 6 IDE
- BennuGD Runtimes, which are the programs and dependencies necessary to compile and run our game. Here's the download page; download the Caanoo build and whatever PC (Windows, Linux, or Mac OSX) build you need. BennuGD Compiler and Runtime There's also the BennuPack on that page, which is a pack of helpful tools and examples to help you make your game.
So, first install the BennuGD PC pack onto your computer. For this example, it is installed in C:\BennuGD. Next, install Komodo Edit. It should be a very simple and easy process. Once it's finished, you should end up with something like this:
|Basic Startup screen of Komodo Edit 6 - Your startup screen will probably look different from this one."|
Now, then, you can see the basic startup screen above fairly clearly. Our goal for this IDE is to enable it to compile our source code and run the compiled file from the IDE. Now, in the ToolBox to the right, right-click and, from the menu that appears, select the Add menu, and from that, New Custom Toolbar. Name it BennuGD Bar - this will contain our tools for compiling and running BennuGD games. You don't actually need to create a toolbar for this, but it will allow the tools to be catagorized easily.
Now, right click in the newly created BennuGD Bar, and then from the menu that appears, select Add > New Command. Name the command 'Compile Main with Debug' - this command will compile our file with debugging mode enabled (so that one can debug problems and dissect the game's processes while running). Here's a screenshot of how the command should appear.
|The command in Komodo Edit for compiling the main file in our project.|
As you can see, the command runs the BennuGD compiler file (bgdc.exe), located in the C:\BennuGD directory. If spaces are present in the path to the BennuGD pack, then you may have to surround the path with quotes. The -g argument tells the compiler to compile the game's source code in debug-enabled mode.
The -i argument tells the compiler program to adds the directory stated ("C:\BennuGD\bin") to the path for the game for it to compile correctly. Finally, "%p\main.prg" tells the compiler to compile the file named 'main.prg', which would be the main source file of our game, in the directory of the project (%p is replaced by the directory of the game project when you call the command). This way, we don't have to highlight the main file in Komodo Edit to build and run the game - we can just call the command while the game project is open, assuming there's a Komodo project file present in our game project folder.
Next, you'll need to create another command - the Run Main command.
|Command for running the main project file in Komodo Edit|
Notice that this is a lot like the Compile Main command - except that this command runs the interpreter program (bgdi.exe) and passes the compiled source file ('main.dcb'), to play. It runs the interpreter in the project folder, which is evident from the 'Start In' section of the command. Once this is done, next you'll need to assign a keybinding to this command. Click on the keybinding tab and assign a nice key to bind it to, like F6. For us, we'll use F5 to compile the program, and F6 to run it.
|The Save and Compile Macro - Saves all files open and compiles the main source file.|
Click the Keybinding tab, and assign it a nice key, like F5. This way, you can select F5 to save all files and compile the 'main.prg' BennuGD program file, and then F6 would play the same main program file. Great! The next part of the tutorial will be in writing a simple Hello World program and porting it to the Caanoo!