Development User Manual - GatorQue/cr-manifests GitHub Wiki

Coding Guidelines

Formatting

  • Indentation uses 2 spaces instead of tabs
  • Continuing previous line indentation uses 4 spaces

Naming conventions

  • Upper camel case for class names (e.g. MyClass)
  • Lower camel case for method names (e.g. myMethod)
  • Lower camel case for parameter and member variables (e.g. myParameterVariable)
  • Issue number will be used for the Git flow feature branch name and code changes to document issue resolution.

Version Control

Git will be used for all version control (except perhaps binary asset management). Google Repo tool will be used to pull multiple Git repositories together. Git Flow branching technique will be used for feature development and for production releases.

Initial setup of development environment

See the Development Environment Wiki page to setup the tools used for development and then follow the following steps.

  1. Create project directory
    1. mkdir cosmicrover
    2. cd cosmicrover
  2. Use Google Repo tool to download cr-manifests git repository
    1. repo init -u https://github.com/GatorQue/cr-manifests.git
    2. repo sync -j 16
      1. NOTE: The -j 16 allows for downloading 16 Git repositories in parallel

Add new CosmicRover project

To add a new CosmicRover Android game project do the following:

  1. Create a Github repository named cr-project-name (e.g. cr-corral)
    1. Check the Initialize with README checkbox
    2. Select Android for the .gitignore style
    3. Select appropriate license (e.g. GPL 2.0/MIT)
  2. Add develop branch
    1. "Select Branch: master" pull down from Github
    2. Type develop in the text box and click "Create Branch: develop" button
  3. Add project to Google Repo manifest XML file
    1. Select cr-manifests repository from Github
    2. Edit default.xml file using Github web editor
    3. Add the following line for the new project:
      1. <project path="project name" name="cr-project-name" remote="github" />
    4. Save the file
  4. Update CosmicRover repo to pull in new project
    1. cd cosmicrover
    2. repo sync -j 16
  5. Optional: Perform "Setup Git flow for this new Git repository" steps described below
  6. Optional: Perform "Create a Git flow feature branch" steps described below
    1. NOTE: Recommend creating first branch to setup Android projects
  7. Optional: Perform "Install libGDX Android projects" steps described below
    1. Perform "Import libGDX Project into Android Studio IDE" steps described below

Setup Git flow for a Git repository

Git flow must be initialized first before using the git-flow Git module scripts. This is typically done at the setup of a new CosmicRover project as described below:

  1. Perform the Add new CosmicRover project steps (if not done yet)
  2. Change directories to the new project repository folder
    1. cd cosmicrover\project folder
    2. git config --add gitflow.origin `git remote`
    3. git flow init
      1. Accept all default values

Create a Git flow feature branch

Deliver a Git flow feature branch

Install libGDX Android projects

Download the latest libGDX setup tool to the cosmicrover directory by doing the following:

cd cosmicrover
wget https://libgdx.badlogicgames.com/nightlies/dist/gdx-setup.jar
java -jar gdx-setup.jar

Use the following answers (adjust as needed) for the libGDX project setup screen.

  • NAME: project-name
  • Package: com.cosmicrover.project-name
  • Game class: ProjectNameGame
  • Destination: /home/rlindeman/cosmicrover/project-name
  • Android SDK: /home/rlindeman/Android/Sdk
  • Sub Projects: (check the following)
    • Desktop
    • Android
    • Ios (if needed)
    • Html (if needed)
  • Extensions: (check the following)
    • Tools
    • (uncheck if not using) Box2d

Click Generate (allow overwrite if it asks) to generate the Android project folders. Close the LibGDX Project Generator window after it completes successfully.

Import libGDX Project into Android Studio IDE

Either after generating the initial Android Studio project or setting up the initial development environment, you must import the Android Studio project files into Android Studio IDE. This can be done by doing the following:

  1. Launch Android Studio IDE from a terminal window
    1. studio.sh &
  2. Select Import project (Eclipse ADT, Gradle, etc.) from the Android Studio IDE Quick Start list
    1. Navigate and select the "cosmicrover/project-name/build.gradle" file
    2. Click OK
    3. Wait for Building 'project-name' Gradle project info to complete
  3. Add Desktop configuration to Android Studio IDE
    1. Select Run->Edit Configurations from the Menu
    2. Click green plus sign and select Application
    3. Fill in the following answers
      1. Name: Desktop
      2. Main class: com.cosmicrover.project-name.desktop.DesktopLauncher
      3. Working directory: .../cosmicrover/project-name/android/assets
      4. Use classpath of module: select desktop module
    4. Click OK
  4. Configure version control system
    1. Select VCS->Enable Version Control Integration
    2. Select Git from pull down
    3. Click OK