OSDN Git Service

【更新内容】
[ring-lang-081/ring.git] / docs / en / target / gameengineandorid.txt
1 .. index:: 
2         single: Building Games For Android; Introduction
3
4 ==========================
5 Building Games For Android
6 ==========================
7
8 In this chapter we will learn about Building RingLibSDL Games for Mobile.
9
10 So we can create packages (*.apk) for the applications that are developed using Ring Game Engine for 2D Games.
11
12
13 .. index:: 
14         pair: Building Games For Android; Download Requirements and Update the Android SDK
15
16 Download Requirements and Update the Android SDK
17 ================================================
18
19 * The Android SDK Tools
20
21         https://developer.android.com/studio/index.html
22
23 * The Android NDK (Tested using android-ndk-r10c)
24
25                 https://developer.android.com/ndk/index.html
26
27 * Apache Ant v1.8 or later 
28
29                 http://ant.apache.org/bindownload.cgi
30
31 * Java SE Development Kit (JDK) v6 or later
32
33                 http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
34
35 * Update the Android SDK to get the API and tools packages required for development
36
37         Tested using Android 4.4.2 (API 19)
38
39 * In Windows - Define the next Environment Variables based on your system.
40
41 (1) JAVA_HOME
42
43 .. code-block:: ring
44         
45         For Example : C:\Program Files (x86)\Java\jdk1.8.0_05 
46
47 (2) ANDROID_HOME        
48
49 .. code-block:: ring
50
51         For Example : B:\mahmoud\Tools\Java-Android\adt-bundle-windows-x86-20140702\sdk
52
53 .. index:: 
54         pair: Building Games For Android; Project Folder
55
56 Project Folder
57 ==============
58
59 Open the project folder : ring/android/ringlibsdl/project
60
61 .. image:: ringlibsdlandroid_shot1.png
62         :alt: RingLibSDL for Android
63
64 You can add the source code (*.ring) and Images/Sound Files to the assets folder.
65
66 .. image:: ringlibsdlandroid_shot2.png
67         :alt: RingLibSDL for Android
68
69 You will find the Flappy Bird 3000 Game ready for building.
70
71 The execution starts from the start.ring file
72
73 .. code-block:: ring
74
75         load "game2.ring"
76
77 .. index:: 
78         pair: Building Games For Android; Building the project
79
80 Building the project
81 ====================
82
83 Move to the ring/android/ringlibsdl/project folder 
84
85 We can build using the next command (We need to do this for one time only).
86
87 .. code-block:: none
88
89         ndk-build
90
91 Then we can create the package (*.apk) using the next command.
92
93 .. code-block:: none
94
95         ant debug
96
97 We can write a batch file for building the project (file: build.bat)
98
99 .. code-block:: none
100
101         rem You will need to modify this batch file based on your environment
102
103         set JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_05
104         set ANDROID_HOME=B:\mahmoud\Tools\JavaAndroid\adt-bundle-windows-x86-20140702\sdk
105         set NDK_ROOT=B:\mahmoud\Tools\JavaAndroid\android-ndk-r10c
106
107         set path=%path%;B:\mahmoud\Tools\JavaAndroid\android-ndk-r10c
108         set path=%path%;B:\mahmoud\Tools\JavaAndroid\apache-ant-1.9.4\bin
109
110         ndk-build