Allegro for new Java developers

Jason Winnebeck edited this page Jul 1, 2016 · 4 revisions
Clone this wiki locally

Allegro for New Java Developers

This page will eventually be a full tutorial on how to start working with Allegro and Java given some basic programming knowledge. For now it is just some links to get started.

Try out the example project in Windows

Jalleg includes a pre-built Allegro for Windows 64-bit Java.

  1. Download the jalleg repository. You can clone with git or download a zip from https://github.com/gillius/jalleg, just click the "clone or download button"
  2. Download and install Java 64-bit JDK from http://www.oracle.com/technetwork/java/javase/downloads/index.html. Get the latest version, Java 8 update 92 at the time of writing. On Linux machines you can work with OpenJDK 8 available from standard repositories.
  3. At this point, you should be able to open a command window and run java -version and javac -version and see Java installed.
  4. Enter the jalleg directory, and you can now run gradlew script if your machine is connected to the Internet. Gradle will download itself and required dependencies such as JNA. Total download will probably be a few 10s of MB the first time you ever run Gradle (downloads will be cached and not repeat on later runs). Run the example via gradlew run. You should see the example start up.

Try out the example project in Ubuntu Linux

The directions below are for Ubuntu systems. The commands are to be run from the terminal (ctrl-alt-T). Tested on Ubuntu 16.04 (xenial), but should work on earlier versions.

  1. Allegro installation instructions from the Allegro wiki:
    1. sudo add-apt-repository ppa:allegro/5.2
    2. sudo apt-get update
    3. sudo apt-get install liballegro5-dev
  2. Installation of Java: sudo apt-get openjdk-8-jdk
  3. If you do not already have git, run sudo apt-get install git
  4. Set up a development directory, mkdir -p ~/dev; cd ~/dev
  5. Check out jalleg: git clone https://github.com/gillius/jalleg.git
  6. cd jalleg
  7. ./gradlew run

Try out the example project in other Linux

  1. Install Allegro from pre-built binaries or source using instructions from the Allegro Getting Started wiki.
  2. Ensure that Java JDK 7 or higher is installed
  3. Download the jalleg repository. You can clone with git or download a zip from https://github.com/gillius/jalleg, just click the "clone or download button"
  4. In the jalleg folder, run ./gradlew run

Try out the example project in OSX

Jalleg has not been tested in OSX yet. However, it probably works this way:

  1. Install Allegro via homebrew
  2. Ensure that Java JDK 7 or higher is installed
  3. Download the jalleg repository. You can clone with git or download a zip from https://github.com/gillius/jalleg, just click the "clone or download button"
  4. In the jalleg folder, run ./gradlew run

Develop with an IDE

I use and suggest the very excellent and free IntelliJ community edition. All of the features you might need for jalleg development are available in the free community edition. It can be downloaded here: https://www.jetbrains.com/idea/. For Windows it comes with a traditional installer. For Linux it comes as a tgz which you unpack and run the bin/idea.sh within. The first time on Linux when you run idea.sh it will ask if you wish to add a launcher shortcut.

After installing and running the IDE, simple open the "gradle.build" in the top level jalleg directory as a project. Everything will be set up for you and everything you need will be downloaded for you via Gradle if not already downloaded when running example earlier.

In the IDE's project tab on the left, navigate to the directory jalleg-examples/src/main/java/org/gillius/jalleg/example folder and in there you will see the examples. You can double click on a file to open and edit it. You can right click on a file and pick run to actually run it. IntelliJ will compile and run the example for you automatically. If you make code changes, just pick "run" again and IntelliJ will compile any changes then run.