This is an implementation of a subset of the [XNA 4.0](https://en.wikipedia.org/wiki/Microsoft_XNA) libraries for use with [Bluebonnet](https://github.com/spaceflint7/bluebonnet) to build games for Android.
**Bluebonnet** is an Android-compatible, light-weight, partial implementation of the .NET platform on top of the Java Virtual Machine. With **Bluebonnet BNA**, you can develop on Windows in C# or F# with the XNA libraries, and export to Android Java without any dependencies on native code libraries. But please note that **Bluebonnet BNA** does not aim for 100% compatibility with either .NET or XNA.
- Download and build the `Bluebonnet` compiler and its runtime library, `Baselib.jar`. For instructions, see [Bluebonnet README](https://github.com/spaceflint7/bluebonnet/blob/master/README.md).
- Download the [FNA](https://github.com/FNA-XNA/FNA/archive/master.zip) source code. Build by typing the following command in the repository directory:
- Download this [BNA](https://github.com/spaceflint7/bna/archive/master.zip) project and build it by typing the following command in the repository directory:
- The `ANDROID_JAR` property specifies the full path to an `Android.jar` file from the Android SDK distribution. `BNA` requires Android SDK version 18 or later.
- The `BLUEBONNET_EXE` property specifies the full path to the Bluebonnet compiler that you built in an earlier step.
- The `FNA_DLL` property specifies the full path to the FNA.DLL that you built in an earlier step. As noted earlier, this path should be `(FNA_DIR)/bin/Release/FNA.dll`.
- If the build is successful, the file `BNA.jar` will be generated in the `.obj` sub-directory of the repository root directory.
## Building the Demo
An example application `Demo1` is provided, which demonstrates some XNA functionality in C# and F#. It can be built using Visual Studio (solution file `Demo1.sln`), or from the command line:
- Type `nuget restore Demo1` to restore packages using [nuget](https://www.nuget.org/downloads).
- Type `msbuild Demo1 -p:Configuration=Release -p:Platform="x86"`
- Test the program: `.obj\Demo1\Release\Demo1.exe`. (Note that this will create the directory `SavedGames\Demo1` in the `Documents` directory.)
- To convert the built application to an Android APK, type the following command: (Note that this is a single-line command; line breaks were added for clarity.)
- Make sure to specify the right paths for the Bluebonnet compiler (via the `BLUEBONNET_EXE` property), the Baselib support library (via the `EXTRA_JAR_2` property), the Android.jar file (via the `ANDROID_JAR` property) and the Android build-tools directory (via the `ANDROID_BUILD` property).
- The parameters are detailed at the top of the [MakeAPK.project](MakeAPK.project) file. See also the comments in the [AndroidManifest.xml](Demo1/AndroidManifest.xml) file, and comments throughout the `Demo1` source files.
- If the build is successful, the file `Demo1.apk` will be generated in the `.obj` sub-directory of the repository root directory.
- The batch file `build_demo.bat` runs the steps discussed in this "Building the Demo" section.