开发Mac OS X和iOS [英] Developing for both Mac OS X and iOS

查看:212
本文介绍了开发Mac OS X和iOS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一款游戏,我希望最终可以在Mac OS X和iOS上使用。什么是最好的方法做到这一点?我应该(1)首先关注一个操作系统,得到一个抛光的版本1.0,然后端口到其他操作系统,或(2)我应该从一开始同时开发?

I'm working on a game that I'd like to ultimately be available for Mac OS X and iOS. What's the best way to do this? Should I (1) focus on one OS first and get a polished version 1.0, then port to the other OS, or (2) should I try to develop for both simultaneously from the start?

如果(1),我应该首先定位哪个操作系统,即哪个移植方向是最简单的?

If (1), which OS should I target first, i.e. which porting direction is the easiest?

如果(2),我需要一个单独的项目在XCode的每个操作系统?

If (2), do I need a separate project in XCode for each OS? If so, how do I maintain just one copy of the platform agnostic code that I share between both projects?

推荐答案

我通常编写代码并行,有时开始在Mac,有时在iOS上。大多数核心功能(即非GUI)在两个平台上几乎是相同的,但有时一些功能缺少某些功能。然后我尝试从较差的平台开始,以便代码可以同时运行。

I usually code in parallel, sometimes starting on Mac, sometimes on iOS. Most of the core functions (i.e. non-GUI) is virtually the same on both platforms, but sometimes some of the functionality is missing on one part. Then I try to start off with the poorer platform so that the code will run on both.

并行工作提供了另一个好处:你需要考虑好的抽象,将会很烦人的重复代码相当快。多个目标真正有助于良好的结构。

Working in parallel gives another benefit: you need to think about good abstraction or you will get annoyed of duplicated code rather quickly. Multiple targets really help with good structure.

对于多个目标 - 是的,在理论上这在Xcode中是有效的。这是一个真正的痛苦(一旦我把我的核心代码在静态库中,并保持一切自动更新,一个失败的参考)。

As for the multiple targets - yes, in theory this works in Xcode. It was a real pain (with losing references over and over) as soon as I put my "core code" in static libs and keeping everything updating automatically.

我的设置如下:

MainWorkspace
   CoreFunctionsMacLibProject
   CoreFunctionsIOSLibProject
   TheApplicationMacProject
   TheApplicationIOSProject


$ b $ p

核心部分的共享代码位于共享文件夹中,更新很容易给定一切都在同一个工作区。它会工作很容易没有单独的库,我只是碰巧使用它们在不同的项目/工作区。

The shared code for the core part is in a shared folder, updates are easy given everything is in the same workspace. It would work easily without the separate libraries, I just happen to use them in different projects/workspaces as well.

到目前为止一切顺利。谈论2-4个libs和几个应用程序项目。只是我的经验,虽然。工作区使这种方法非常灵活,因为您可以将项目放在多个工作区中。

So far everything goes smooth. Talking about 2-4 libs and several app projects. Just my experience, though. Workspaces make this approach pretty flexible, as you might put a project in more than one workspace.

这篇关于开发Mac OS X和iOS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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