简体   繁体   English

我应该如何构造iPhone OpenGL ES 1.1游戏?

[英]How should I structure my iPhone OpenGL ES 1.1 game?

I am building an iPhone OpenGL ES 1.1 game. 我正在构建iPhone OpenGL ES 1.1游戏。 I am using the OpenGL ES template provided by xcode. 我正在使用xcode提供的OpenGL ES模板。 I am only using the ES1Renderer. 我只使用ES1Renderer。

I've coded some basic touch actions the user can take, and I've begun to think about the overall structure of the code. 我已经编写了用户可以执行的一些基本的触摸操作,并且已经开始考虑代码的整体结构。 All I'm really doing is using C in the ES1Renderer.m for my entire game state. 我真正要做的就是为整个游戏状态在ES1Renderer.m中使用C。 I have an array of bullet structs, an array on enemy structs, etc.. 我有一个子弹结构数组,一个关于敌人结构的数组,等等。

Besides using this structure, where my entire game state is in ES1Renderer.m as C arrays and structs, what other ways are there to structure the code? 除了使用这种结构之外,我的整个游戏状态都以C数组和结构的形式存在于ES1Renderer.m中,还有哪些其他方式来构造代码? Should I be using C++ or Objective-C classes to represent the enemies so they are more modular? 我应该使用C ++还是Objective-C类来表示敌人,以便它们更具模块化?

The main reason I ask this is because I don't normally code in C, C++ and Objective-C..so I am a little fuzzy on coming up with a good architecture here. 我问这个问题的主要原因是因为我通常不使用C,C ++和Objective-C编写代码。因此,我对在这里提出一个好的体系结构有些不确定。

Check "OpenGL ES for iOS". 选中“ OpenGL ES for iOS”。 There are native "Programming Guide" from Apple and 4 "Sample Code". 有来自Apple的本地“编程指南”和4个“示例代码”。 Link: http://developer.apple.com/devcenter/ios/resources/opengl-es/ 链接: http//developer.apple.com/devcenter/ios/resources/opengl-es/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM