什么是花栗鼠?(除了是一个物理引擎)

What is Chipmunk? (Apart from being a Physics Engine)(什么是花栗鼠?(除了是一个物理引擎))

本文介绍了什么是花栗鼠?(除了是一个物理引擎)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望这个问题不像我担心的那样愚蠢,但它可能仍然很愚蠢.

Hopefully, this question isn't a dumb as I fear it sounds, but it may still be pretty dumb.

我是 Objective-C 和 Cocoa 的新手.事实上,总的来说,我对 C 完全陌生.我正在尝试使用 Cocos2d-iPhone 实现 iPhone 游戏.这是我以前用 Flash 制作的游戏,所以我认为这将是一个很好的方法来学习 Objective C、cocoa 和 cocos2d.

I'm new to Objective-C, and Cocoa. In fact, I'm completely new to C in general. I'm trying to implement an iPhone game using Cocos2d-iPhone. It's a game I've made before in Flash, so I thought it would be a nice way to lean Objective C, cocoa and cocos2d.

我有一个大问题是理解为什么所有 Chipmunk代码看起来与所有普通的 Objective-C 东西都不一样.例如,有这样的东西

One thing I am having a big problem with is understanding why all the Chipmunk code looks different to all the normal Objective-C stuff. For example, there's stuff like

chipmunkBody->position.x

我以为是的

chipmunkBody.position.x 或者可能是 [[chipmunkBody position] x] (可能是不好的例子).

chipmunkBody.position.x or maybe [[chipmunkBody position] x] (bad example maybe).

这种一直在咬我的一种方法是使用 cpVect.cpVect 非常重要,但我一生都无法弄清楚如何传递它.CGPoint,没问题,我可以制作指针,在方法中传递它们等等,但第二次我使用 cpVect 代替,它是欢迎来到 Errorville,填充你".

One way this keeps on biting me in the ass is with cpVect. cpVect is pretty important, but I can't for the life of me figure out how to pass it around. CGPoint, no problem, I can make pointers, pass them around in methods and what not, but the second I use cpVect instead, it's "welcome to Errorville, population you".

这就是问题所在,Chipmunk 是什么,所以我可以开始了解有关使用它的更多信息.

So that's the question, what is Chipmunk, so I can start finding out more about working with it.

谢谢-t

推荐答案

我没用过Chipmunk,不过应该是C/C++写的.就是这个原因.

I haven't used Chipmunk, but it's probably written in C/C++. That's the reason.

是的,它是用 C 语言编写的.

Yup, it's written in C.

chipmunkBody 是一个指向结构体的指针,而箭头操作符(->)是通过指向结构体的指针访问结构体成员的方式C.

chipmunkBody is a pointer to a struct, and the arrow operator (->) is how you access the members of a struct through a pointer to the struct in C.

这篇关于什么是花栗鼠?(除了是一个物理引擎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:什么是花栗鼠?(除了是一个物理引擎)

基础教程推荐