祝大家中秋节快乐

祝老婆开心快乐! 祝全家人身体健康! 也祝大家一切安好!

中秋快乐!

>> 继续阅读 <<

[译]是否有快速强制Crash的方法?

Forcing a crash is a great way to test out the SDK, but is actually a little more tricky than you might think.

强制crash是很好的一种测试SDK的方式,但实际上是一个比你想象的更棘手一点。

How to force a crash We’ve built a convenient API you can use to cause a crash:

###怎样去强制crash 我们构建一个便捷的API你能用于制造一个crash:

[[Crashlytics sharedInstance] crash];

  1. First, make sure you place your test crashing code in a different place than applicationDidFinishLaunching. This is only for testing – Crashlytics will detect crashes in your applicationDidFinishLaunching method. A good place could be a button action.
  2. Next, compile, build, and run your app.
  3. Then, make sure that a debugger is not connected. By default, Xcode will launch applications and attach a debugger. This will prevent the crash from reporting – detach it!
  4. Force the crash by pressing the button you attached the crash code to, and then relaunch the app.
  1. 首先,确保你把你的测试crash代码写在不同于applicationDidFinishLaunching地方.这仅仅为了测试–Crashlytics将检测crash在你的applicationDidFinishLaunching方法里。好方法是用一个按钮触发。
  2. 接下来,编译,构建,运行你的app。
  3. 然后, 确保debugger未被连接。默认情况下,Xcode将运行应用程序且伴随了debugger。这将防止报告crash–隔离它。
  4. 伴随着你的crash代码按下按钮强制crash,然后重新运行app。

Advanced If you’d like to see other kinds of crashes, you can experiment:

###高级 如果你喜欢看其他种类的crash,你能尝试: int *x = NULL; *x = 42;

You may also want to raise an exception. Some common ways to do that are:

你或许也想去制造一个异常。一些通用方法是: ` [NSObject doesNotRecognizeSelector]; [arrayWithOnlyTwoElements objectAtIndex:3]; `

Keep in mind that exceptions are not guaranteed to a crash. (The full code path, including code in system libraries matters here.)

记住那些异常不保证crash。(完整的代码路径,包括系统库中的代码问题在这儿。)

Fun fact Divide-by-zero is illegal on i386 and x84-64, but is a valid operation on ARM! Dividing by zero will cause crashes in the simulator, but not on iOS devices.

###有趣的事实

在i386和x84-64除以0是非法的,但是在ARM上是一个有效的操作! 在模拟器里除以0将制造crash,但是在iOS设备不会。

>> 继续阅读 <<

[译]更多RoboVM后台更新

Today i continued working on some RoboVM backend todos. Multi-touch is now working properly, the fix was rather simple, once you understand that you have to enable multi-touch on a view in a single line of code on iOS.

今天我继续工作在一些RoboVM后台待办事项上。 多点触控 现在完全可用,修复相当简单,你立刻就能理解,你必须启用多点触控,在iOS视图上就简单的一行代码。

You can now also use the gdx-freetype extension with the RoboVM backend. From the nightlies, get the extensions/gdx-freetype/ios/libgdx-freetype.a file, put it in your $ROBOVM_PROJECT/libs/ios folder, then add the following to your robovm.xml file:

你现在也可以用RoboVM后台 的gdx-freetype 扩展。从nightlies获取extensions/gdx-freetype/ios/libgdx-freetype.a文件,把它放到你的$ROBOVM_PROJECT/libs/ios文件夹里,然后添加如下的robovm.xml文件:

<libs> ... <lib>libs/ios/libgdx-freetype.a</lib> </libs>

You also have to link to the gdx-freetype.jar in your RoboVM project (or link to it from your core project, and make sure it’s exported in Eclipse).

你也必须在你的RoboVM工程里链接gdx-freetype.jar(或者从你的核心工程链接它,确保它是用Eclipse导出的)。

I also managed to finally get the Bullet physics extension compiling for iOS. LLVM/Clang previously went into a “i’ll eat all your CPU” infinite loop. Applied a quick fix found on the bullet forums, and things compiled. Our wrapper uses SWIG to generate the JNI bridge, which in turn uses some more or less advanced JNI/VM features RoboVM doesn’t support yet. We’ll have to wait until that gets fixed in RoboVM before we can have our physically correct cloth simulations run on iOS.

我也终于得到为iOS编译的Bullet物理扩展。 LLVM/Clang之前陷入“我会吃你的CPU”的无限循环。在bullet论坛上找到了快速修复办法。我们的包装使用SWIG来产生JNI桥接,这反过来又使用JNI/VM一些或多或少先进功能而RoboVM不支持JNI桥。我们将不得不等直到得到在RoboVM上的修复,才能够有正确的物理凝结模拟器iOS上运行。

>> 继续阅读 <<

[译]RoboVM后台更新

A couple of quick updates. First of all, you can track the progress and todos on the RoboVM backend in this file.

一对快速更新。首先,你可以在这个文件中跟踪RoboVM后台进度和待办事项。

A couple of bugs have been fixed, including Preferences and various FileHandle/Files issues. Thanks for Niklas and Nex for that. Pixels per inch/centimeter calculations had a bug as well, that’s been fixed. The graphics context didn’t have a depth buffer, that’s been fixed as well.

一对bug已经修复,包括偏好和各种FileHandle和Files问题。谢谢Niklas和Nex所做的。每像素/每英寸计算也有bug,已经修复。图形上下文没有一个深度缓存,也已经修复了。

I extended the IOSApplicationConfiguration so that you can specify the color depth, depth buffer precision, stencil precision and multisampling. You can also set a preferred frames per second value.

我扩展了IOSApplicationConfiguration,这样你能指定色彩深度,深度缓存精度,模具精度和多重采样。你也可以设置每秒喜好的帧。

There are still a few issues that need ironing out. Multi-touch support has the highest priority, followed by orientation and accelerator fixes. After those it’s time to test all other features.

仍然有几个问题需要消除。支持多点触控具有最高优先权,其次是方向和加速修复。在哪之后就是测试所有其他特性了。

If you ran into issues with the JSON class, here’s a tip on how to get things going. You need to tell RoboVM to force linking in the classes you read in via JSON through reflection. You can to that in the robovm.xml file like so:

如果你用JSON类有问题,这儿有一些提示怎么样去继续。你需要去告诉RoboVM,在类里面通过反射去读每个JSON要强制链接。你可以在robovm.xml配置: <forceLinkClasses> <pattern>com.badlogic.gdx.scenes.scene2d.ui.*</pattern> </forceLinkClasses>

Which links in all classes from that package. You can also use other Ant like patterns, e.g. ** to include everything in a package recursively.

包中的所有类哪个链接。你也可以使用其他ant正则,例如 ** 递归包括一个包中的所有内容。

And finally, check the forums, a couple of folks already ported their games over, reporting very nice improvements in performance. Here’s Delver which i ported in about 30 minutes :)

最后,检查论坛,一对开发者已经移植他们的游戏过来了,在性能方面报告非常好。这个Delver我移植用了30分钟。 Delver

Stuff is in constant flux, so make sure you update both the libgdx nightlies and the RoboVM Eclipse plugin. To update the RoboVM libgdx stuff, make sure you replace gdx.jar, gdx-backend-robovm.jar, and the ios/libgdx.a file in your RoboVM project!

材料是在不断变化的,因此确保你更新libgdx最新版和RoboVM Eclipse插件。更新RoboVM libgdx材料,确保你在你的RoboVM工程里替换gdx.jar,gdx-backend-robovm.jar和ios/libgdx.a文件。

>> 继续阅读 <<

[译]我如何通过GitHub的API在短短的几分钟内发送30万邮件

To all watchers of the libgdx repository: i’m terribly sorry and hope i didn’t interfer with your work in any way

致libgdx资源库的所有关注者:我非常抱歉且希望我没有以任何方式干涉到你的工作。

This is meant as a cautionary tale about using Github’s API on a repository with quite a few watchers (460 in this case).

这是一个警示的故事通过在资源库上使用Github的API针对不少的关注者。(这个案例中是460)。

Earlier this year we migrated our code from Google Code to Github. We didn’t have a good migration plan for the 1200 or so issues back then, so we kept them on Google Code. We now have about 1700 issues on the tracker

今年早些时候我们从Google Code迁移我们的代码到Github。我们没有一个好的迁移计划去迁移1200个左右问题,因此我们保持他们在Google Code上。我们现在有大约1700个问题跟踪。

Today i finally wanted to tackle the issue tracker migration, using a Python script i found on Github. The script requires one to specify a Github user account that owns the repository the issues will get migrated to. I did a dry run on a fork of the main repo using my Github account, fixed up some issues in the script, and validated things to the best of my abilities. Things looked good.

今天我最终想去处理问题跟踪迁移,用一个我在Github上找到的Python 脚本。这个脚本必须指定一个我们将迁移到的自己资源库的Github 用户账号。我用我的Github账号在主资源库的一个fork上做了一个枯燥无味的运行,在这个脚本里解决了一些问题,且尽我最大的能力进行了验证。事情看起来挺好。

Then i ran it on the main repository. Luckily i was watching our IRC channel. After about 4 minutes, people started to scream. They each received 789 e-mails from Github. Every single issue i migrated, and every single comment of each issue triggered an e-mail notification to all watchers of the main repository.

然后我运行它在主资源库上。幸运地我一直在看我们的IRC渠道。大约4分钟后,人们开始尖叫。他们每个人都收到来自Github的789封邮件。每一个我迁移的单一issue,并且每一个issue的每一个单一注释触发一封邮件提醒给主资源库的所有关注者。

This wasn’t apparent to me during the dry runs, as i used my own Github account. The script posts all issues/comments with the user account i supplied, so naturally, i did not get any notification mails.

这个枯燥无味的运行对我来说不是显而易见的,作为我用我自己的Github账号。这个脚本用我提供的用户账号发布所有的问题或评论,所以自然地我没有接收到任何提醒邮件。

I stopped the script after 130 issues (4 minutes), and immediately started sending out apologies and a mail to Github support, to which i haven’t received an answer yet. I send roughly 300k mails through their server in a matter of minutes. If i hadn’t watched IRC, i’d have send out about 4 million mails to 460 people within an hour.

我在130个问题(4分钟)后停止了这个脚本,并且立即开始发送道歉还给Github支持一封邮件,我还没有得到答案。我通过他们的服务器在短短几分钟内就发送了大约30万封邮件。如果我没有看IRC,我肯定会在一小时内发送大约400万封邮件给460个人。

>> 继续阅读 <<

[译]Box2D API的改变

We are cleaning up the core a little, and in the process eliminate usage of Java collections and replacing them with our own collections.

我们正在清理核心的一点,并在这个过程中用我们自己的集合去替换和消除使用的Java集合。

One of our contributors started with box2D, see this pull request.

从box2D我们的贡献者之一,看pull request.

In short:

  • methods that returned ArrayLists, such as body.getFixtureList(), now return Arrays
  • method calls to these objects will need to be change from ArrayList API to Array API, i.e. bodyFixtures.size() –> bodyFixures.size, bodyFixtures.isEmpty() –> (bodyFixtures.size == 0)

简言之:

  • 方法返回值ArrayLists,例如body.getFixtureList(),现在返回Arrays
  • 方法调用这些对象将需要从ArrayList API改变为Array API,例如 bodyFixtures.size() -> bodyFixtures.size,bodyFixtures.isEmpty() -> (bodyFixtures.size == 0)
>> 继续阅读 <<

[译]重大的libgdx问题跟踪和Wiki Github迁移

A little less than a year ago, we moved all our code from Google Code to Github. That was a nerve racking but ultimately beneficial task. Since our move, we had almost 600 pull requests!

不到一年前, 我们迁移Google Code上所有代码到Github。它是一个神经折磨但是最终是个有益任务。 自从我们迁移以来,我们收到了差不多600个pull request!

A few months ago we rewrote our website, with the help of Bitowl and XKlibur from IKIGames (whom you all should follow!). We added some nice features, like allowing you to submit your games to our gallery, among other things.

几个月前我们重写了我们的官网, 有从IKIGames(你都应该follow)的Bitowl和XKlibur的帮助.我们加了一些不错的功能,比如允许你提交你的游戏,其中就有我们的展廊。

Now it’s time to complete the cycle. Today i’m going to migrate our issue tracker to Github, and move the Wiki there as well. Sinistersnare (you can meet him on IRC) went crazy and manually translated our entire Google Code Wiki to a Github Wiki. Not sure yet how to repay him, but we all should be super proud to have such kind souls in our community!

现在是时候完成整套了。今天我将迁移我们的问题跟踪到Github,并且也移动Wiki. Sinistersnare(你能在IRC见到他)疯了并且手动转移我们的整个Google Code Wiki到Github Wiki. 不知道该怎么报答他,但是我们都应该超自豪的在我们的社区有许多心灵鸡汤。

The final step will be to integrate the wiki with the official site, and replace the current documentation page. This will be done in a similar way as it’s already done for the news blog posts. And i will add a comment system via Disqus so folks can leave comments. The Github Wiki will be publicly editable, through the history we can track if someone does something stupid and revert. I hope this will futher help improving the libgdx documentation and make it easier for newcomers to find the info they need.

最后一步将去整合wiki官方网站,替换当前文档页面。她将采用已经完成的新闻博客文章的方式去做。并且我将添加Disqus评论系统以便于开发者能留言。Github Wiki将开放编辑,通过历史记录我们可以跟踪恢复,如果有一些愚蠢的人做的事。我希望这将进一步帮助改进libgdx文档,并能使新人更容易找到他们所需要的信息。

Wish me luck and send a pony to sinistersnare!

祝我好运吧,送一个小马给sinistersnare!

>> 继续阅读 <<

[译]Nextpeer拥抱GDX,GDX后面拥抱Nextpeer

Nextpeer 原文链接:http://www.badlogicgames.com/wordpress/?p=3166

NextPeer is a service for creating synch and asynch multiplayer games, with tons of features. The big differentiator between NextPeer and Google Play Game Services is that it actually works on both Android and iOS (only leaderboards are crossplatform in GPGS) and that it allows both asynch and synch multiplayer games (only synch is supported by GPGS). The fine folks over at NextPeer, who have their headquaters in Isreal, contacted me a while ago to see if there’s a way to collaborate.

NextPeer是一个被用于创建同步和异步多人游戏的服务,有很多特性功能。NextPeer和Google Play 游戏服务最大的不同是,它实际上适用于Android和iOS(仅排行榜跨平台GPGS),它允许异步和同步多人游戏(仅支持同步由GPGS)。优秀的开发者在Nextpeer,总部设在以色列,前段时间,NextPeer与我联系,看看是否有合作的可能。

We agreed that we’d start out with working on a libgdx integration guide. Turns out it’s as easy as adding their Android library to your game’s Android project, and then use a tiny shim to make it work with the rest of the libgdx infrastructure. You can find a modified Super Jumper example on Github.

我们同意我们着手进行libgdx集成指南。原来它是那么容易,因为他们的Android库添加到你的游戏的Android项目,然后用一个小垫片把它寄托于libgdx的基础设施上。你可以找到一个修改Super Jumper example on Github

The shim is currently a bit incomplete but can be easily extended if necessary. Also, things do not yet work for iOS. We’ll hold out with that until we finished the RoboVM transition.

垫片目前有点不完整的,但如果有必要,能很容易扩展。此外,事情还不能工作在iOS上。我们会坚持直到我们完成了RoboVM的过渡。

In the meantime, hop over to NextPeer’s website, register a free account and start integrating multiplayer in your game!

在此期间,跳到NextPeer的网站,注册一个免费帐户,并开始整合多人在你的游戏!

>> 继续阅读 <<

Couldnt load shared library

在用libgdx游戏引擎进行案例开发时,遇到以上问题,google,stackoverflow.com,github.com/…issue,libgdx community 各种方法都试过了,都没有一个能解决的。

我沉下心来静静的思考,从错误异常来看,此种异常应该是非常简单的,只是无法加载这个文件而已,那我去找到这个文件,让它能加载不就解决了吗?

有了这样的思考,我就尝试着按照以下步骤去解决:

  1. 根据提示,使用的gdx-freetype64.dll,所以我们需要去extensions\gdx-freetype里找
  2. 每个目录结构都找过了,没有显式出现,有两个jar包,一个gdx-freetype.jar,一个是gdx-freetype-natives.jar,从命名上看,我们就能够猜想出来,我们所需要的文件很可能就在gdx-freetype-natives.jar里面,抑制不住内心的激动,打开一开,果然有我们所需要的文件

dll 名词解释:动态链接库英文为DLL,是Dynamic Link Library 的缩写形式,DLL是一个包含可由多个程序同时使用的代码和数据的库,DLL不是可执行文件。动态链接提供了一种方法,使进程可以调用不属于其可执行代码的函数。函数的可执行代码位于一个 DLL 中,该 DLL 包含一个或多个已被编译、链接并与使用它们的进程分开存储的函数。DLL 还有助于共享数据和资源。多个应用程序可同时访问内存中单个DLL 副本的内容。DLL 是一个包含可由多个程序同时使用的代码和数据的库。 百度百科 动态链接库(Dynamic Link Library或者Dynamic-link library,缩写为DLL),是微软公司在微软视窗操作系统中实现共享函数库概念的一种实作方式。这些库函数的扩展名是.DLL、.OCX(包含ActiveX控制的库)或者.DRV(旧式的系统驱动程序)。 wiki

  1. 有可能我们没有加上面两个必要的文件到classpath,所以导致无法加载,问题就此迎刃而解。

一个字,激动,两个字,非常激动。

O(∩_∩)O哈哈~

>> 继续阅读 <<

[译]RoboVM后台在libgdx nighties里的第一次演示

原文链接RoboVM backend in libgdx nightlies and first performance figures!

翻译原文链接:http://www.maiyang.me/posts/2013/09/12/robovm-backend-in-libgdx-nightlies-and-first-performance-figures

简单翻译一下,如果有任何错误或不对的地方,请指正。

I’ve spent the weekend integrating the libgdx RoboVM backend into our build as well as the setup-ui. I’m happy to report that both tasks have been completed! If you want to give it a spin, here’s what you need to do:

我耗费了整个周末将libgdx RoboVM后台不仅集成到我们的构建里而且还有setup-ui。我很高兴向大家报告,这两个任务都已经完成了!如果你想用它,下面是你需要做的:

  • Get a Mac, you can only develop for iOS with a Mac. This also includes getting a developer certificate from Apple if you want to test on a device. Sorry, blame Apple
  • 获取一个Mac,你仅仅能在Mac上开发iOS.如果你想在设备上测试,你还要从苹果获取一个开发者认证。 对此我很抱歉,归咎于苹果。

  • Install the necessary prerequisits. For RoboVM that means installing an Eclipse plugin, from this plugin URL: http://download.robovm.org/eclipse/ and installing XCode on your Mac. That’s it!

  • 安装必要的prerequisits。为了RoboVM意味着要安装一个Eclipse插件, 插件URL:http://download.robovm.org/eclipse/ 并且在你的Mac上安装XCode. 就这样!

>> 继续阅读 <<