To develop with AgateLib on Linux, first you must have Mono installed. You can download Mono from the Mono-Project web site. This includes MonoDevelop, the C# IDE for Linux. Many Linux distributions include a version of mono in their repositories. Check with your distribution to see what package you need to install to get Mono and MonoDevelop. You also need Mono's WinForms implementation. Most likely, installing MonoDevelop from the package manager will include all the dependencies you need to do general development with Mono and AgateLib. OpenSUSE 11.1: Download Once you have a working copy of Mono, you should download AgateLib version 0.3.1 from the SourceForge site. Extract it to a folder, say ~/Agate. Creating a Project Note: These instructions were written for MonoDevelop 2.4. There may be minor differences if you are using a different version. In MonoDevelop, create a new C# project (Shift+Ctrl+N) and name it TestAgate. You can skip the packaging / unix integration boxes in the next dialog. You should be able to pick any language you like, but be sure to pick an Empty Project underneath it. Picking a language other than C# may make the instructions that follow a little different, so you may want to start with C# until you get familiar with how to setup a new project. Setting the runtime In order to use AgateLib effectively, you need to be using the .NET 3.5 or newer stack. If you are using MonoDevelop 2.4, the default for new projects is .NET 3.5, so you can skip this step, unless you want to use .NET 4.0. Otherwise, to make this change, look in the Solution window on the left hand side. There will be a tree there with Solution TestAgate and TestAgate under it. Expand them both. Right click the project (titled TestAgate) and choose Options. In the new window that comes up, underneath Build there will be General. Click that, and on the right hand side, make sure the runtime version to at least 3.5 and click OK. Adding AgateLib references Once you have a new project created, look in the Solution window on the left hand side. so that you see the references folder. Right click that folder, and choose Edit References. Pick the tab that is titled .Net Assembly. At the top you will see a file browser. Pick the folder that you extracted AgateLib to (~/Agate if you are following this tutorial), go to the Binaries/Release/Drivers folder. Select AgateLib.dll, AgateLib.WinForms.dll, AgateOTK.dll and AgateSDL.dll all at once by holding Ctrl. Click Add and then OK to add the references to your project. Adding Source Code Now back in the Solution window, we need to add a source code file. Right click on your project (named TestAgate), go down to Add and choose New File.... MonoDevelop will give you several choices on what to add here. You want to click the General category on the left hand side, and then choose Empty File on the right hand side. Name this file TestAgate.cs and click New. Copy and paste the following code into the TestAgate.cs file.
Now build and run the application by pressing the F5 key. If you did everything right, then the application should crash with an unhandled exception! Unfortunately, there's one more important step, which should be handled by MonoDevelop but isn't. Copying DLL config files If you look inside the directory where you extracted AgateLib (ie. ~/Agate), you should see a file OpenTK.OpenGL.dll.config and a Linux folder. The config file must be manually copied to the same directory as the executable that is produced by the Mono compiler. The Linux folder contains other files that components of AgateLib depend on that are specific to Linux. At the moment, this is only the FMOD library. To use FMOD, these files must also be copied to the same directory as your executable. So open up a terminal window and execute the following two commands: cp ~/Agate/*.config ~/Projects/TestAgate/TestAgate/bin/Debug Note: You may have to change the above lines depending on choices you made previously. If you changed the name of your project from TestAgate, you will have to use your project name. If you didn't choose to make a separate directory for the solution, the target directory structure will be something like ~/Projects/ProjectName/bin/Debug. Also, if you extracted AgateLib to a different directory than ~/Agate, you will need to change that. Now if you go back to MonoDevelop and push F5 to build and run your project, you should have a window with a "Hello World" title with a green background. Congratulations, you have just written your first application using AgateLib!
|
|||
|
|
