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.
这篇关于什么是花栗鼠?(除了是一个物理引擎)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:什么是花栗鼠?(除了是一个物理引擎)
基础教程推荐
- 在 gmail 中为 ios 应用程序检索朋友的朋友 2022-01-01
- android 应用程序已发布,但在 google play 中找不到 2022-01-01
- 如何在 UIImageView 中异步加载图像? 2022-01-01
- 当从同一个组件调用时,两个 IBAction 触发的顺序是什么? 2022-01-01
- 如何让对象对 Cocos2D 中的触摸做出反应? 2022-01-01
- Kivy Buildozer 无法构建 apk,命令失败:./distribute.sh -m “kivy"d 2022-01-01
- Android:对话框关闭而不调用关闭 2022-01-01
- UIWebView 委托方法 shouldStartLoadWithRequest:在 WKWebView 中等效? 2022-01-01
- 如何在 iPhone 上显示来自 API 的 HTML 文本? 2022-01-01
- 如何在没有IB的情况下将2个按钮添加到右侧的UINavigationbar? 2022-01-01