forked from chukong/quick-cocos2d-x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
zh.html
327 lines (257 loc) · 9.17 KB
/
zh.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
<style>
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote {
margin: 0;
padding: 0;
}
body {
font-family: "Helvetica Neue", Helvetica, "Hiragino Sans GB", Arial, sans-serif;
font-size: 13px;
line-height: 18px;
color: #737373;
background-color: white;
margin: 10px 13px 10px 13px;
}
table {
margin: 10px 0 15px 0;
border-collapse: collapse;
}
td,th {
border: 1px solid #ddd;
padding: 3px 10px;
}
th {
padding: 5px 10px;
}
a {
color: #0069d6;
}
a:hover {
color: #0050a3;
text-decoration: none;
}
a img {
border: none;
}
p {
margin-bottom: 9px;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #404040;
line-height: 36px;
}
h1 {
margin-bottom: 18px;
font-size: 30px;
}
h2 {
font-size: 24px;
}
h3 {
font-size: 18px;
}
h4 {
font-size: 16px;
}
h5 {
font-size: 14px;
}
h6 {
font-size: 13px;
}
hr {
margin: 0 0 19px;
border: 0;
border-bottom: 1px solid #ccc;
}
blockquote {
padding: 13px 13px 21px 15px;
margin-bottom: 18px;
font-family:georgia,serif;
font-style: italic;
}
blockquote:before {
content:"\201C";
font-size:40px;
margin-left:-10px;
font-family:georgia,serif;
color:#eee;
}
blockquote p {
font-size: 14px;
font-weight: 300;
line-height: 18px;
margin-bottom: 0;
font-style: italic;
}
code, pre {
font-family: Monaco, Andale Mono, Courier New, monospace;
}
code {
background-color: #fee9cc;
color: rgba(0, 0, 0, 0.75);
padding: 1px 3px;
font-size: 12px;
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
}
pre {
display: block;
padding: 14px;
margin: 0 0 18px;
line-height: 16px;
font-size: 11px;
border: 1px solid #d9d9d9;
white-space: pre-wrap;
word-wrap: break-word;
}
pre code {
background-color: #fff;
color:#737373;
font-size: 11px;
padding: 0;
}
sup {
font-size: 0.83em;
vertical-align: super;
line-height: 0;
}
* {
-webkit-print-color-adjust: exact;
}
@media screen and (min-width: 914px) {
body {
width: 854px;
margin:10px auto;
}
}
@media print {
body,code,pre code,h1,h2,h3,h4,h5,h6 {
color: black;
}
table, pre {
page-break-inside: avoid;
}
}
</style>
<title>设置 Quick-Cocos2d-x 在 Windows 下的编译环境</title>
</head>
<body>
<h1>设置 Quick-Cocos2d-x 在 Windows 下的编译环境</h1>
<p>配置编译环境的基本步骤:</p>
<ol>
<li>下载 Quick-Cocos2d-x 源代码</li>
<li>设置运行环境</li>
<li>安装 Java SDK</li>
<li>安装最新的 Android ADT bundle 和 Android NDK</li>
<li>编译 LuaJavaBridge 示例,并在 Android 真机上进行测试</li>
</ol>
<h2>Step 1: 下载 Quick-Cocos2d-x 源代码</h2>
<p>访问 <a href="https://github.com/chukong/quick-cocos2d-x/releases">https://github.com/chukong/quick-cocos2d-x/releases</a> 下载最新版 quick 源代码。</p>
<p>由于 <strong> Android SDK </strong> 和 <strong> NDK </strong> 的问题,<strong> Quick-Cocos2d-x 目录的放置有一定要求 </strong> :</p>
<ol>
<li>必须和 Android SDK/NDK 在同一个分区</li>
<li>不能放在根目录</li>
<li>路径中不能包含中文和空格(所以别放桌面了)</li>
</ol>
<p>~</p>
<h2>Step 2: 设置运行环境</h2>
<p>运行 <strong>setup_win.bat</strong>,完成运行环境的设置工作,成功会看到如下界面:</p>
<p><img src="res/howto_setup_development_environment_windows_00.png" alt="" /></p>
<p>启动 <strong>player/win/player.exe</strong>,即可运行示例和您的项目。</p>
<p><img src="res/howto_setup_development_environment_windows_00_.png" alt="" /></p>
<p>~</p>
<h2>Step 3: 安装 Java SDK</h2>
<p>从 <a href="http://www.oracle.com/technetwork/java/javase/downloads/">http://www.oracle.com/technetwork/java/javase/downloads/</a> 下载最新版的 Java SDK,并进行安装。</p>
<p>~</p>
<h2>Step 4: 安装最新的 Android ADT bundle 和 Android NDK</h2>
<p>1.从 <a href="http://developer.android.com/sdk/">http://developer.android.com/sdk/</a> 下载最新的 <strong> ADT Bundle for Windows </strong>。</p>
<p>2.解压缩 adt-bundle-windows-x86-2014????.zip 。</p>
<p>3.将目录 adt-bundle-windows-x86-2014???? 改名为 android 。</p>
<p>4.将目录 android\sdk 改名为 android\android-sdk-windows 。</p>
<p>5.从 <a href="http://developer.android.com/tools/sdk/ndk/index.html">http://developer.android.com/tools/sdk/ndk/index.html</a> 下载 Android NDK r9?</p>
<p>6.解压缩 android-ndk-r9?-windows-x86.zip</p>
<p>7.将目录 android-ndk-r9? 移动到 android\android-ndk-r9?</p>
<pre><code>最终的目录结构:
</code></pre>
<pre><code>
<PATH_TO>\android\android-ndk-r9?
<PATH_TO>\android\android-sdk-windows
<PATH_TO>\android\eclipse
</code></pre>
<p><img src="res/howto_setup_development_environment_windows_01.png" alt="" /></p>
<p>8.运行 <strong> android\android-sdk-windows\tools\android.bat </strong> , 选中 <strong> Android SDK 2.2 </strong>( <strong> 如果看不到 Android SDK 2.2,请设置代理 </strong> ), 然后安装需要的包。</p>
<p><img src="res/howto_setup_development_environment_windows_02.png" alt="" /></p>
<p>~</p>
<h2>Step 5: 编译 LuaJavaBridge 示例,并在 Android 真机上进行测试</h2>
<p>启动 命令行提示符 程序, 改变当前目录为 <PATH_TO>\Quick-cocos2d-x\sample\luajavabridge\proj.android, 运行 build_native.bat:</p>
<pre><code>
cd Quick-cocos2d-x\sample\luajavabridge\proj.android
build_native.bat
</code></pre>
<p>如果一切正常,等待几分钟以后会看到如下信息:</p>
<pre><code>
SharedLibrary : libgame.so
Install : libgame.so => libs/armeabi/libgame.so
</code></pre>
<h3>将项目导入 Eclipse ADT</h3>
<p>启动 <PATH_TO>\eclipse\eclipse.exe, 导入 <strong> libcocos2dx </strong> 库(这个库是 Cocos2d-x 的 Java 支持).</p>
<p>1.选择菜单 <strong> File </strong> -> <strong> Import </strong>, 再选择 <strong> Android </strong> -> <strong> Existing Android Code Into Workspace </strong> :</p>
<p><img src="res/howto_setup_development_environment_windows_06.png" alt="" /></p>
<p>2.点击 <strong> Browse </strong> 按钮, 选择 <strong> \Quick-cocos2d-x\lib\cocos2d-x\cocos2dx\platform\android\java </strong> 目录:</p>
<p><img src="res/howto_setup_development_environment_windows_07.png" alt="" /></p>
<p>3.点击 Finish.</p>
<p>4.重复上述步骤, 将 <strong> luajavabridge\proj.android </strong> 目录导入 Eclipse:</p>
<p><img src="res/howto_setup_development_environment_windows_08.png" alt="" /></p>
<p>5.在左侧 <strong> Package Explorer </strong> 里的 <strong> LuajavaBridge </strong> 项目上点击鼠标右键,选择菜单 <strong> Properties </strong> :</p>
<p><img src="res/howto_setup_development_environment_windows_09.png" alt="" /></p>
<p>6.如果 <strong> Library </strong> 中已经存在 <strong> libcocos2dx </strong> 项,请先删除。然后点击 <strong> Add </strong> 按钮, 再选择添加 <strong> libcocos2dx </strong> 库.</p>
<p><img src="res/howto_setup_development_environment_windows_10.png" alt="" /></p>
<p>7.导入完成。</p>
<h3>设置 Android 设备允许真机调试</h3>
<p>Android 官方文档:<a href="http://developer.android.com/tools/device.html">http://developer.android.com/tools/device.html</a></p>
<ol>
<li>Enable USB debugging on your device.
<ul>
<li>On most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.</li>
<li>On Android 4.0 and newer, it’s in Settings > Developer options.</li>
</ul>
<p> Note: On Android 4.2 and newer, Developer options is hidden by default. To make it available, go to Settings > About phone and tap Build number seven times. Return to the previous screen to find Developer options.</p>
<ul>
<li>在系统设置中找到“开发者选项”,打开“USB调试”。</li>
</ul>
</li>
<li>Set up your system to detect your device.
<ul>
<li>If you’re developing on Windows, you need to install a USB driver for adb. For an installation guide and links to OEM drivers, see the OEM USB Drivers document.</li>
<li>根据不同的机型,也许需要安装该机型特定的 USB 驱动程序。例如 Moto 就必须安装 Moto 的 USB 驱动。</li>
</ul>
</li>
</ol>
<h3>在设备上测试 LuaJavaBridge 示例</h3>
<p>1.在 Eclipse 里选择菜单 <strong> Window </strong> -> <strong> Show View </strong> -> <strong> Other… </strong> , 再选择 <strong> Android </strong> -> <strong> Devices </strong>.</p>
<p>2.如果设备设置完成,并且安装了正确的 USB 驱动,那么在 Devices 标签页中就可以看到你的设备:</p>
<p><img src="res/howto_setup_development_environment_windows_11.png" alt="" /></p>
<p>如果看不到设备,请仔细检查设备设置和驱动程序。</p>
<p>3.在项目 <strong> LuajavaBridge </strong> 上点击鼠标右键, 选择菜单 <strong> Debug As </strong> -> <strong> Android Application </strong>. 如果一切正常,等一会儿就可以在设备上看到运行画面了:</p>
<p><img src="res/howto_setup_development_environment_windows_12.png" alt="" /></p>
<p>-EOF-</p>
</body>
</html>