Mac开发 - 帮助入门的2D游戏 [英] Mac dev - Help getting started with 2d games

查看:237
本文介绍了Mac开发 - 帮助入门的2D游戏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想作一些简单的2D游戏/克隆(适用于Mac),但我有几个问题:

I want to make some simple 2d games/clones (for Mac), but I have a few questions:

  • 我应该使用石英2D 的OpenGL (我不打算3D很快试试)
  • 似乎有很多typedef定义之类的东西CGF​​loat的/ GLfloat,这我应该使用?
  • 我应该使用的Objective-C的游戏太(类),或者不仅仅是C? (我想我会用Objective-C和可可的窗口和视图。)
  • 是否罚款重绘每次整个看法?我真的不明白是怎么的NSView的-drawRect dirtyRect参数的工作原理,它怎么知道我想要什么更新?
  • 是否有任何好的教程吗?
  • Should I use Quartz 2d or OpenGL (I don't plan to try 3d anytime soon)
  • There seems to be a lot of typedef'd things like CGFloat/GLfloat, which should I use?
  • Should I use Objective-C for the game too (classes) or just C? (I assume I'll use Objective-C and Cocoa for window and views.)
  • Is it fine to redraw the entire view each time? I don't really understand how the NSView's -drawRect dirtyRect parameter works, how does it know what I want to update?
  • Are there any good tutorials for this?

感谢。

推荐答案

石英或核心动画与OpenGL的实际上取决于你正在努力做的事情。如果你想简单的绘图和动画,用石英或CA.如果你想快速/强大的游戏,使用OpenGL。最后,我建议学习两个。

Quartz or Core Animation vs. OpenGL really depends what you're trying to do. If you want simple drawing and animation, use Quartz or CA. If you want fast/powerful games, use OpenGL. Eventually I'd suggest learning both.

有关的typedef定义的东西,无论是给你使用特定的系统中使用。石英/ CA / CG,使用CGFloat的。对于OpenGL的,使用GLfloat。

For the typedef'd things, use whichever is meant for the specific system you're using. For Quartz/CA/CG, use CGFloat. For OpenGL, use GLfloat.

目标-C与C也取决于你想要的速度。 Objective-C的开销增加了一点点,但会(明显),让你创造更大的面向对象的游戏。如果你使用Quartz和Core Animation和任何的OBJ-C或C,如果使用OpenGL,我建议使用Objective-C。但是,如果你是一个Mac上做这个(如不是为iPhone),你可能不会看到太大的区别,除非你正在做复杂的快速绘制。

Objective-C vs. C also depends on the speed you want. Objective-C adds a little bit of overhead but will (obviously) let you create much more object-oriented games. I'd suggest using Objective-C if you use Quartz and Core Animation, and either Obj-C or C if using OpenGL. However, if you're doing this on a Mac (e.g. not for iPhone), you probably won't see much difference unless you're doing complex fast drawing.

我不能完全肯定的drawRect,但这个问题有一些信息它可以回答这个问题要问你。

I'm not entirely sure about drawRect, but this question has some information which may answer that question for you.

有关的介绍,以石英,我建议本教程和我'已经永远听到讷河教程推荐的OpenGL。

For an intro to Quartz, I'd recommend this tutorial, and I've always heard the NeHe tutorials recommended for OpenGL.

这篇关于Mac开发 - 帮助入门的2D游戏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆