Android 游戏框架 libgdx 学习笔记 - 简介

引用本文请注明来源:[url]http://yhz61010.iteye.com/blog/1939144[/url]

[b]什么是 libgdx[/b]
它是一个免费的游戏开发框架。强调一下,libgdx 不是一个游戏引擎(engine),而一个开发框架(framework),用它可以写出一个游戏引擎(例如,AndEngine)。这一点官网上写的很清楚![quote][url]https://code.google.com/p/libgdx/wiki/GoalsFeatures#What_libgdx_is[/url]
[url]https://code.google.com/p/libgdx/wiki/GoalsFeatures#What_libgdx_is_not[/url][/quote]
除此之外,关于什么是 libgdx 大家可以 Google 或 Baidu 一下。不过在这里我还是要引用下官网原文:[quote]引用地址:[url]https://code.google.com/p/libgdx/#What_is_libgdx?[/url]
Libgdx is a cross-platform game development library written in Java, with some JNI code for performance hungry sections. It abstracts away the differences between writting desktop, Android, iOS and HTML5 games based on standards like OpenGL ES/WebGL. Applications can be prototyped and developed entirely on the desktop, then only 6 lines of code are needed to run your app on Android or HTML5.
其它官网引文:
[url]https://code.google.com/p/libgdx/wiki/Introduction#Introduction[/url]
[/quote]
大致翻译一下啊:
Libgdx 是使用 Java 写的一个跨平台的游戏开始框架,对于性能要求高的部分使用了 JNI 代码编写(C/C++)。它对不同平台(桌面,Android,iOS 和 HTML5)之间的写法差异进行了抽象(例如基于标准的 OpenGL ES/WebGL)。你的应用原型开发可以完全在桌面平台上进行,然后仅通过 6 行代码,就可以让你的应用运行在 Android 或 HTML5 上。

[b]官网地址[/b]
[url]https://code.google.com/p/libgdx/[/url]
[b]下载地址[/b]
[url]https://code.google.com/p/libgdx/downloads/list[/url]
[b]源码及示例[/b]
https://github.com/libgdx/libgdx


[b]示例代码的运行[/b]
[color=red]以 libgdx 0.9.8 版本为例进行说明。[/color]
以官方 superjumper 为例进行说明。
1. 从官网下载 superjumper 例子。
下载地址:
[url]https://github.com/libgdx/libgdx/tree/master/demos/superjumper[/url]

2. 将 superjumper-android 和 superjumper 导入到 Eclipse 中。

3. 在 Eclipse 中,右键点击 superjumper 项目 -> Properties -> Java Build Path -> Projects 在此移除有错的 Projects。之后再点击 Libraries 标签,引用如下 4 个 jar:
gdx.jar
gdx-natives.jar
gdx-backend-lwjgl.jar
gdx-backend-lwjgl-natives.jar

4. 运行桌面版程序。
右键点击 superjumper 项目 -> Run AS -> Java Application,然后选择主类 SuperJumperDesktop。
恭喜你,你的桌面版 superjumper 已经可以运行了。

5. 运行 Android 版本程序。(以 Eclipse ADT 版本 22.0.5 为例进行说明)
a) superjumper-android 项目的 libs 文件夹下,引用如下 2 个 jar 包:
gdx.jar
gdx-backend-android.jar
b) 右键点击 superjumper-android 项目 -> Properties -> Java Build Path -> Projects 移除有错的 Projects并添加 superjumper 到本项目(若已经添加则不用重复添加)。
c) 之后再点击 Order and Export 标签,选中 superjumper,并将它移动到最上面。
此时你的项目应该没有出现任何错误提示。此时你就可以在模拟器或真机中调试你的应用了。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值