Skip to content
This repository has been archived by the owner on Nov 26, 2018. It is now read-only.

Getting Started (for Linux users)

Pedro edited this page Jul 27, 2014 · 17 revisions

Compiling for Linux

  1. Use your distribution package manager to install vala, sdl2, sdl2_image, sdl2_mixer, sdl2_gfx, sdl2_net, sdl2_ttf, chipmunk
  • Make sure to install chipmunk version 6.2.0 or higher.
  1. Clone or download and extract SDL2 VAPIs to any place you want.

    git clone https://git.gitorious.org/sdl-2-0-vala-vapi/pedrohlc-sdl2-vala-vapi.git
  2. Open a terminal in the extracted folder and then run:

    sudo ./INSTALL
  • (After this you can delete this folder as it won't be longer necessary)
  1. Clone or download and extract our repository on any place you want.

  2. Open a terminal inside "avalanche/sdks/vapi" and then run:

    sudo ./INSTALL
  3. Copy "avalanche/sdks/template" to anywhere you want, feel free to rename it to any desired name, in this new folder your project will be developed.

  4. Inside yours project folder, create a bash file to keep your environment variables, something similar to this:

#!/bin/sh
export AVALANCHE_DIR="/home/pedrohlc/Projects/avalanche"
make $*
  1. When you're ready open a terminal and run your new bash file.

Cross Compiling for Windows (only different steps)

  1. Use your distribution package manager to install
    vala, mingw-w64-glib2, mingw-w64-sdl2, mingw-w64-sdl2_image, mingw-w64-sdl2_mixer, mingw-w64-sdl2_gfx,
    mingw-w64-sdl2_net, mingw-w64-sdl2_ttf, mingw-w64-chipmunk, mingw-w64-libgee
  • (Check "Useful files" on our wiki for pre-built packages if necessary)
  1. Inside yours project folder, create a bash file to keep your environment variables, something similar to this:
#!/bin/sh
export CROSS=MINGW
export AVALANCHE_DIR="/home/pedrohlc/Projects/avalanche"
make $*
  1. For running you're gonna need to copy the following files into project's "bin" folder:
libbz2-1.dll, libffi-6.dll, libfreetype-6.dll, libgcc_s_sjlj-1.dll, libgee-0.8.dll, libglib-2.0-0.dll, libgobject-2.0-0.dll, libiconv-2.dll, libintl-8.dll, libpng16-16.dll, libSDL2_gfx-1-0-0.dll, libstdc++-6.dll, libwinpthread-1.dll, SDL2.dll, SDL2_image.dll, SDL2_mixer.dll, SDL2_net.dll, SDL2_ttf.dll, smpeg2.dll, zlib1.dll

Cross Compiling for Android (only different steps)

You're gonna need to know how to create an Android project in Eclise and how to insert a library into it.

  1. Use your distribution package manager to install vala

  2. Choose, download and extract anywhere one of ours Android Toolchain, available here.

  3. Inside yours project folder, create a bash file to keep your environment variables, something similar to this:

#!/bin/sh
export CROSS=ANDROID
export ANDROID_TOOLCHAIN="/home/pedrohlc/Projects/my_android_toolchain"
export AVALANCHE_DIR="/home/pedrohlc/Projects/avalanche"
make $*
  1. When you're ready open a terminal and run your new bash file. A new file with name "./bin/libgame-android.so" will be created in folder "bin".
  • You can also "strip" this file to reduce it size. (Better use toolchain's "strip")
  1. Create a new Android Project in Eclipse, add "SDLActivity.java" (available on SDL2's source) to your sources (keep it's package hierarchy), make your main activity extend this new class by changing this line: public class MainActivity extends SDLActivity {

  2. Edit "SDLActivity.java" static lib loading to look this way:

// Load the .so
static { System.loadLibrary("game-android"); }
  1. Copy any file inside original project "res" folder (images, sounds, fonts) to folder "assets" in Android project.

  2. Copy "libgame-android.so" to folder "libs/armeabi/" (depending in the processor architecture you're targetting, instead of "armeabi" it can be others names) in your Android project.

  3. You probably will find interesting changing this options in "AndroidManifest.xml":

  • Allow assets to be installed/moved to sdcard, add in "manifest" tag:
android:installLocation="preferExternal"
  • Running game in fullscreen, add in "application" tag:
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
  • Preventing crash when rotating screen or opening a keyboard, add in "activity" tag:
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"