cpSpaceHashEach - 同一行有 2 个问题

发布于 2024-12-10 13:20:55 字数 261 浏览 3 评论 0原文

我正在尝试掌握花栗鼠的基础知识。在一些教程中我发现了一行:

cpSpaceHashEach(space->activeShapes, &updateShape, nil);

但我在这里遇到了 2 个错误:

1)隐式声明函数在 C99 中无效

2)“struct cpSpace”中没有名为“activeShapes”的成员

有什么问题?为什么不起作用?我还需要添加其他内容吗?

I'm trying to grasp basics of Chipmunk. In some tutorial I found a line:

cpSpaceHashEach(space->activeShapes, &updateShape, nil);

But I get 2 mistakes here:

1) Implicit declaration of function is invalid in C99

2) No member named 'activeShapes' in 'struct cpSpace'

What is wrong? Why doesn't it work? Do I need to include something else?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不打扰别人 2024-12-17 13:20:55

只是为了澄清一些代码,以防其他人遇到此问题,而不是

cpSpaceHashEach(space->activeShapes, &updateShape, nil); 

使用:

cpSpaceEachShape(space, &updateShape, nil);

显然,此更改已完成,因此更容易保持代码面向未来,因为 activeShapes 并不意味着以这种方式使用。

Just to clarify with some code in case anyone else runs into this problem, instead of

cpSpaceHashEach(space->activeShapes, &updateShape, nil); 

you'd use:

cpSpaceEachShape(space, &updateShape, nil);

Apparently this change was done so it is easier to keep the code future-proof since the activeShapes were not meant to be used in this way.

流年已逝 2024-12-17 13:20:55

深入研究变更日志:(https://github.com/slembcke/Chipmunk-Physics/blob/master/VERSION.txt)

如果您查看,您会发现在 Chipmunk 5.x cpSpace 中。*形状被标记为私有标头中 cpSpace 结构的成员。然后,在 Chipmunk 6.x 中,默认情况下禁用私有访问,并且出现了 cpSpaceEachShape() 函数,它几乎完全取代了您尝试执行的 cpSpaceHashEach() + cpSpace.activeShapes。

Digging into the changelog: (https://github.com/slembcke/Chipmunk-Physics/blob/master/VERSION.txt)

If you look, you'll find that in Chipmunk 5.x cpSpace.*Shapes were marked as private members of the cpSpace struct in the header. Then, in Chipmunk 6.x, private access was disabled by default and a cpSpaceEachShape() function appeared that almost exactly replaced cpSpaceHashEach() + cpSpace.activeShapes that you are trying to do.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文