Moai - Start Guide
Upcoming SlideShare
Loading in...5
×
 

Moai - Start Guide

on

  • 2,685 views

Do you want more? Join us on facebook clicking the "I Like" button: http://www.facebook.com/imathings - Our website: http://www.imathings.com - Our blog: http://imathings.wordpress.com

Do you want more? Join us on facebook clicking the "I Like" button: http://www.facebook.com/imathings - Our website: http://www.imathings.com - Our blog: http://imathings.wordpress.com

Statistics

Views

Total Views
2,685
Views on SlideShare
2,229
Embed Views
456

Actions

Likes
3
Downloads
29
Comments
0

1 Embed 456

http://imathings.wordpress.com 456

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Moai - Start Guide Moai - Start Guide Presentation Transcript

  • • QUICK START• BUILDING• MORE
  • To start developing Moai apps we are going to need the next tools (noteverything is mandatory, but all them will make easier our lives): • CYGWIN • GIT • MOAI SDK (MOAI-DEV) • ZERO BRANE STUDIOIn the next slides we will show from where you can download each tool, andhow you can install/prepare everything to start developing.
  • From where? •URL: http://cygwin.com •Direct Download: http://cygwin.com/setup.exeWhy? Cygwin is a collection of tools which provide a Linux look and feel environment for Windows. We will need it to execute successfully the different Moai scripts. For example to rebuild the Moai libraries or recreate the Android host. We will use it also to download the moai-dev repo instead use cmd (also possible).Special steps: When the wizard ask you for the packages to install you must add these, or different errors will occurs when you execute the scripts : •binutils (this pack include ar and ranlib, both needed) •cpio •sed •make
  • From where? •URL: https://github.com/ •Direct Download: http://git-scm.com/download/winWhy? We will need it to download the last Moai source code from the moai-dev repo in github.Special steps During the installation, select the "Run Git from the Windows Command Prompt" option, thus you will be able to run it from cygwin (look at the picture on the right).
  • From where? •URL: https://github.com/moai/moai-dev •Direct Download 1: https://github.com/moai/moai-dev/archive/master.zip •Direct Download 2: Using GIT, see below.Why? Instead download the Moai SDK from the moai website, we are going to use the moai-dev repo, thus we will work with the latest Moai libraries. Also downloading the moai-dev repo we will get the Moai source code, and you will need it if you want to add some feature to the SDK.Steps downloading using GIT 1. Open a cygwin terminal. 2. Write this to start downloading the repo to your local hard disk: git clone https://github.com/moai/moai-dev.git [<dir>] The optional <dir> is the path where you want to download the repo content, or current dir will be used if you dont specify it.
  • Steps downloading using GIT (continue) Instad use "<drive letter>:" to specify the logical drive location, you must use "/cygdrive/<drive letter>/". For example: "git clone https://github.com/moai/moai- dev.git /cygdrive/c/apis/moai-dev", will download the repo to windows folder: "c:apismoai-dev". 3. Wait and in some minutes you will have it downloaded. When the process is finished you can close the terminal. 4. Set the environment variables: • Open a Windows command prompt. • Write and execute: setx MOAI_BIN "<dir>vs2010binWin32Debug" *<dir> = full path to the moai-dev folder. • Write and execute: setx MOAI_CONFIG "<dir>samplesconfig" *<dir> = full path to the moai-dev folder. • Close the cmd window.
  • From where? •URL: http://studio.zerobrane.com •Direct Download: https://download.zerobrane.com/ ZeroBraneStudioEduPack-0.34-win32.exeWhy? We will use it to develop, test and debug our developments in windows.Special Step Open it and select: Project > Lua Interpreter > Moai CONGRATULATIONS! Now, you are ready to write your code and test it without problems, have fun!
  • Now that we can develop using Moai, we need build our appto be installed in iOS and Android. • BUILDING FOR IOS • BUILDING FOR ANDROIDIn the next slides we will show how to do it for each system.
  • What do I need? • System: OSX • IDE: Xcode (you already have it installed, right?) • A clone of moai-dev repository, already downloaded.I have it, and now? First, we need the moai libs for ios. 1. Open the folder “xcode” inside your moai-dev folder. 2. Open the folder “libmoai” and edit the file “build.sh”. 1. Comment the three “osx…” lines at the beginning. 2. Remove the “armv7s” argument from the ios_architectures field. 3. Remove the “osx” argument from the usage field.
  • I have it, and now? (continue) 4. Save and close the file. 3. Open the terminal console. 4. Write and execute: cd /<dir>/xcode/ios/libmoai *<dir> = full path to the moai-dev folder. 5. Write and execute: ./build.sh 6. Wait until the build finishes, this will take some time. 7. When the build is finished, close the terminal and go to the folder “/tmp/moai/ios/Release/universal”. Copy out all the libraries inside it. Now, we have to configure our xcode project. 8. Open the folder “xcode” inside your moai-dev folder. 9. Copy the folder “ios” to your desired location. You can rename it. 10. Open the folder copied and edit the file “mt.default” (and if exists the file “moai-target” with the same information).
  • I have it, and now? (continue) 1. The first line must be the full path to your moai source code folder. 2. Fix the path in the second line: /<dir>/src/lua-modules lua-modules *<dir> = full path to the moai-dev folder. 3. Save and close the file. 11. Open the xcode project “MoaiSample.xcodeproject” located in the actual folder. 12. Optionally you can change the project name: 13. Add to the project all the libraries from your copied folder in the step 7. And finally, time to build and test your app!
  • What do I need? • System: Windows used in this tutorial • IDE: Eclipse • Android libs: Android SDK, Android NDK, ADT plugin for eclipse • Also: Java Development Kit, Apache ANT • A clone of moai-dev repository, already downloaded.Ops.. I don’t have all that, thus let’s to install it! • APACHE ANT • JAVA DEVELOPMENT KIT • ANDROID SDK • ANDROID NDK • ECLIPSE AND ANDROID PLUGINOk, finally I am ready, and now? • LET’S DO IT
  • From where? •URL: http://ant.apache.org •Direct Download: http://ftp.udc.es/apache/ant/binaries/apache-ant-1.8.4-bin.zipWhy? We will need it to build a new Android host.Steps to install 1. Download and unzip it. 2. Set the environment variables: 1. Open a Windows command prompt. 2. Write and execute: setx ANT_HOME "<dir>" *<dir> = full path to the unzipped download 3. Write and execute: setx PATH "%PATH%;%ANT_HOME%bin" /m 4. Close the cmd window.
  • From where? •URL: http://www.oracle.com/technetwork/java/javase/downloads/index.html •Direct Download: jdk-6u37 Note: I have not tested the JDK 1.7, so I copied the link to JDK 1.6 but feel free to test.Why? We will need it to work with the Android project in Eclipse.Special steps 1. Set the environment variables: 1. Open a Windows command prompt. 2. Write and execute: setx JAVA_HOME "<dir>" *<dir> = full path to the installed JDK folder 3. Write and execute: setx PATH "%PATH%;%JAVA_HOME%bin" /m 4. Close the cmd window.
  • From where? •URL: http://developer.android.com/sdk/index.htmlWhy? We will need it to create Android apps!Steps 1. Download, unzip and execute the SDK Manager. 1. Update/install tools and the APIs (at least I suggest API 10 and API 17). 2. Close the SDK Manager and open de AVD Manager. 1. Configure one device for each API (at least for API 10 and API 17). 2. In all the devices, active the flags: • Hardware keyboard pressent • Use host GPU. • If you select a device with 1024 RAM configured, is possible that it cant be executed from Eclipse. Later, if the emulator cant launch, try it with 900 or less.
  • From where? •URL: http://developer.android.com/tools/sdk/ndk/index.htmlWhy? We will need it to build the ant host.Steps 1. Download and unzip. 2. Set the environment variables: 1. Open a Windows command prompt. 2. Write and execute: setx PATH "%PATH%;<dir>" /m *<dir> = full path to the unzipped download. 3. Close the cmd window.
  • From where? •URL: http://eclipse.org/mobileWhy? We will need it to debug, test and build Android apps.Steps to install 1. Start Eclipse, then select Help > Install New Software. 2. Click Add, in the top-right corner. 3. In the Add Repository dialog that appears, enter "ADT Plugin" for the Name and the following URL for the Location: https://dl-ssl.google.com/android/eclipse/ 4. Click OK. If you have trouble acquiring the plugin, try using "http" in the Location URL, instead of "https" (https is preferred for security reasons). 5. In the Available Software dialog, select the checkbox next to Developer Tools and click Next.
  • Steps to install (continue) 6. In the next window, youll see a list of the tools to be downloaded. Click Next. 7. Read and accept the license agreements, then click Finish. If you get a security warning saying that the authenticity or validity of the software cant be established, click OK. 8. When the installation completes, restart Eclipse. Once Eclipse restarts, you must specify the location of your Android SDK directory: 9. In the "Welcome to Android Development" window that appears, select Use existing SDKs. 10. Browse and select the location of the Android SDK directory you recently downloaded and unpacked. 11. Click Next. Also you can change the SDK location going to: window > preferences > android.
  • I am ready! First, we have to build the libraries. Also, you must do these steps if you modify something from the moai source code, but that is another history. 1. Open cygwin console. 2. Go to “/ant/libmoai” folder inside your moai-dev folder. 3. Write and execute: ./build.sh 4. This will take some time. Next, we are going to create the host. 5. Still with cygwin opened, go to “/ant” folder inside your moai-dev folder. 6. Write and execute: ./make-host.sh –s –p com.domain.name Note that you should use your own domain name. Now, is time to create the android project. 7. Still with cygwin opened, go to “/ant/untitled-host” folder inside your moai-dev folder.
  • I am ready! (continue) 8. Open to edit the file “settings-local.sh”. 1. Set the “android_sdk_root” var with the full path of your Android SDK. 2. Set the “src_dirs” var with the full path of your moai source code project. Remember: instead use "<drive letter>:" to specify the logical drive location, you must use "/cygdrive/<drive letter>/". For example, to set the folder: “c:apisandroid-sdk", you have to write: “/cygdrive/c/apis/android-sdk". 9. Save and close the file. 10. Write and execute: ./run-host.sh 11. Wait until the process finish, and close the cygwin window. 12. Open the folder “antuntitled-host” inside your moai-dev folder. 13. Do: right click in the build folder > properties > security > advanced > edit > select your user > active all the allow flags > ok > active the flag “Replace all existing…” > ok > yes > ok 14. Open the build folder. 15. Copy the three folders (facebook, project and tapjoy) to your desired folder. You can rename the “project” folder to your desired name project.
  • I am ready! (continue) Now let’s to configure the project in eclipse. 16. Open eclipse. 17. Import the three folders that you copied in the step 15 (using: File > import > Existing projects into workspace). Note that in the folder /assets/lua of the main project, you have the moai source code. Also you can modify it without repeat all the process again. 1. Right click in the project folder > run as > Android Application [> select the AVD to launch the app] And finally, you will see your app in the emulator!
  • You can find all our manuals and tips in our blog: imathings.wordpress.comDon’t forget to go to our web and take a view to our iPhone and iPad applications: www.imathings.com And to be connected with us, follow us on Facebook and Twitter: www.facebook.com/imathings - @imathingsblog