-
Notifications
You must be signed in to change notification settings - Fork 1
Getting Started
Follow these steps to get started using LibLOL
To use LibLOL, you will need the following software installed:
- Android Studio
- Git
The instructions on this page assume you are working in a Microsoft Windows environment.
Note, too, that these instructions essentially mirror those at the LibGDX Setup Page
It should go without saying, but you'll need git and Android Studio. Installing Android Studio should provide you with almost everything you need: a recent JDK, the IntelliJ IDE, the Android SDK, and Gradle.
Again, this is probably obvious, but clone the repository to a new folder using the command
git clone https://github.com/mfs409/liblol.git
Start Android Studio, and choose "Import Non-Android Studio project". Navigate to the folder where you cloned liblol, and choose the build.gradle file. Android Studio will take a little while, and then it will present you with the main Android Studio interface. If you are asked to restart or install anything, choose "yes".
To make it possible to test your code without installing it onto a phone, you will need to add a "Desktop" target. Go to the "Run" menu and choose "Edit Configurations". From there, click the green "+" symbol in the top left corner, and choose "Application". Then set the following fields of the screen that appears:
- Name: enter the text "Desktop"
- Main Class: enter the text "com.me.mylolgame.desktop.DesktopLauncher"
- Working Directory: navigate to your android/assets folder
- Use classpath of mod...: select "desktop"
In the menu bar, to the left of the green "run" triangle, you should now be able to choose between "android" and "Desktop".
The code that you checked out will not have the right name. We need to fix that. This involves changing the package name for your project. To start, you'll need to think of a good package name. Remember that the package should be globally unique. A common strategy is to use your domain name, with the tokens in reverse, followed by your game name. So, for example, if my game was named "superfish" and my domain was worldsbestfishgames.com, then the package should be com.worldsbestfishgames.superfish.
Once you have a name in mind, go to the "project" tab on the left side of the screen in Android Studio, and open up "core" and then "java". Right click on com.me.mylolgame, and select "Refactor", then "Move". Choose the first option (move package to another package), select "OK", and then choose "Yes" to the question about changing multiple directories. Enter your package name, and then at the bottom of the screen, below the preview, choose "Do Refactor". You'll probably be prompted to do a "Gradle Sync"... choose yes. Then, to be sure everything worked, run your game.
You're going to need to do some git cleanup, since a lot of names changed, but it should be pretty straightforward.
Finally, note that your repository is still connected to the github liblol repository. To disconnect it, go to a command prompt and type:
git remote rm origin
You can set a new origin if you're going to be version controlling your code in a different repository.
That ought to do it... you should be able to start developing your liblol game, with Android and Desktop targets. If you intend to do iOS development, you're best bet is to start from the LibGDX Setup Page.