windows 一款 C# 游戏来统治他们(iOS、Android、WP7、W7、Mac OS X 和 XBOX)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4066877/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
One C# game to rule them all(iOS, Android, WP7, W7, Mac OS X and XBOX)
提问by Qcom
Hey, I'm learning C# and just thought of a cool idea. Considering that a game was simple enough. Say, a remake of a classic text-entry style game, a C# game could theoretically be ported to all of the platforms I listed above, with little to no change of the original source code, correct?
嘿,我正在学习 C#,刚刚想到了一个很酷的主意。考虑到游戏已经足够简单了。比如说,一个经典的文本输入风格游戏的重制版,一个 C# 游戏理论上可以移植到我上面列出的所有平台上,原始源代码几乎没有变化,对吗?
Obviously the UI would have to be tweaked, and I highly doubt such a game would really survive on each of those platforms!
显然,用户界面必须进行调整,我非常怀疑这样的游戏是否真的能在每个平台上生存!
But, although C# is really MS heavy, through different methods, that could work, right? Or, would I have to change the C# source to Objective-C? Does Android even have an official language that they support like Apple and MS do?
但是,虽然 C# 真的是 MS 重,但通过不同的方法,它可以工作,对吧?或者,我是否必须将 C# 源代码更改为 Objective-C?Android 是否甚至有像 Apple 和 MS 那样支持的官方语言?
This is kind of an odd question, but if this is true, then C# is really a nice all-purpose language even though it's largely based on and endorsed by MS.
这是一个奇怪的问题,但如果这是真的,那么 C# 确实是一种很好的通用语言,即使它主要基于 MS 并得到 MS 的认可。
回答by Mick N
I decided to post an answer cause I thought of a few more relevant things to say.
我决定发布一个答案,因为我想到了一些更相关的事情要说。
First to answer your questions: Yes it would work. No, you wouldn't have to port to Objective-C. Android's apps often use Java.
首先回答您的问题:是的,它会起作用。不,您不必移植到 Objective-C。Android 的应用程序通常使用 Java。
And a bit more background...
还有一点背景……
I'm hearing good things about MonoTouchand MonoDroidfor cross platform development using .Net, C#.
我听到关于MonoTouch和MonoDroid使用 .Net、C# 进行跨平台开发的好消息。
You've already accepted that you'll have to handle UI layers specifically for each platform, so you're on the right path.
您已经接受了必须专门为每个平台处理 UI 层的事实,因此您走在正确的道路上。
Importantly, on Sept 9, Apple relaxed their guidelines that previously prevented apps built using Monotouch from being released in the marketplace.
重要的是,9 月 9 日,Apple 放宽了之前阻止使用 Monotouch 构建的应用程序在市场上发布的指导方针。
Statement by Apple on App Store Review Guidelines
In particular, we are relaxing all restrictions on the development tools used to create iOS apps, as long as the resulting apps do not download any code. This should give developers the flexibility they want, while preserving the security we need.
特别是,我们放宽了对用于创建 iOS 应用程序的开发工具的所有限制,只要生成的应用程序不下载任何代码。这应该为开发人员提供他们想要的灵活性,同时保持我们需要的安全性。
Also of interest, from Craig Dunn's blog...
同样有趣的是,来自 Craig Dunn 的博客......
ConceptDev (Craig Dunn's blog): MonoTouch meet WindowsPhone7
回答by Quintin Robinson
Mostly it is a pipedream, you could use C#/XNA to make an Windows/Xbox/WP7 game and likely use C# via Mono/MonoTouch to make a OS X/iOS implementation. Android doesn't have a suitable mono implementation at the moment to support this though.
大多数情况下这是一个白日梦,您可以使用 C#/XNA 来制作 Windows/Xbox/WP7 游戏,并且可能通过 Mono/MonoTouch 使用 C# 来制作 OS X/iOS 实现。不过,Android 目前没有合适的单声道实现来支持这一点。
This is not at all meant to be discouraging, also MS has given the C# language to the community so that is positive..
这根本不是要令人沮丧,而且 MS 已将 C# 语言提供给社区,因此这是积极的..
回答by RameshVel
I am not a game development expert, but here my 2 cents,
我不是游戏开发专家,但这里有我的 2 美分,
You dont have any problems with developing games in c# targets all the platforms, mono c#runs sucessfully in all above said plaforms including monodroid- andriod and MonoTouch- iphone.
用 c# 开发面向所有平台的游戏没有任何问题,mono c#可以在上述所有平台中成功运行,包括monodroid- andriod 和MonoTouch- iphone。
But the problem is specific to the graphic libraries you are going to use. For example Xbox libraries only targets windows. But if you stick with openGL, you may solve the problem.
但问题是特定于您将要使用的图形库。例如,Xbox 库仅针对窗口。但是如果你坚持使用openGL,你可能会解决这个问题。
回答by Jeff Kelley
You may be better off sticking to C++, for which iOS and Android have native support.
您最好坚持使用 C++,iOS 和 Android 都支持 C++。
回答by gbjbaanb
There's no reason to needC#, after all you can use Vb.net for ASP.net development :) (no joking, its a better language especially considering the embedded xml support VB has)
没有理由需要C#,毕竟你可以使用 Vb.net 进行 ASP.net 开发:)(不是开玩笑,它是一种更好的语言,尤其是考虑到 VB 具有的嵌入式 xml 支持)
However, for mobile development, I think you're going the wrong route for cross-platform development. For this, you're always going to get 80% of the coverage, that last 20% is going to be a pain. For example, if you choose C#, you'll get Windows and XBox, but not Playstation and very poor iPhone.
但是,对于移动开发,我认为您在跨平台开发方面走错了路。为此,您将始终获得 80% 的覆盖率,最后 20% 将是痛苦的。例如,如果您选择 C#,您将获得 Windows 和 XBox,但不会获得 Playstation 和非常糟糕的 iPhone。
So, you need the lowest common demoninator - and that's probably C++. You can put a Qt GUI on top (with the excellent QML which is possibly the best UI tech at the moment), and that'll run on most platforms - including Android. But not WinPhone7. C++ is still a good option for all platforms as even Windows will run it (C++/CLI) and there's easy bridge between objective-C and C++ anyway. Your best option is probably to go that route (and a lotof games development is done in C++ anyway so its not wasted effort).
因此,您需要最低级的常见恶魔——这可能是 C++。您可以将 Qt GUI 放在顶部(使用出色的 QML,这可能是目前最好的 UI 技术),并且可以在大多数平台上运行 - 包括 Android。但不是 WinPhone7。C++ 仍然是所有平台的不错选择,因为即使是 Windows 也会运行它(C++/CLI),并且无论如何在 Objective-C 和 C++ 之间有一个简单的桥梁。你最好的选择可能是走那条路(而且很多游戏开发都是用 C++ 完成的,所以它不会浪费精力)。
Chances are though, you're not ever going to get a single codebase to work well enough on all platforms. Perhaps javascript would be the ultimate though, as MS' Bob Muglia has saidthey're not focussing on Silverlight anymore, preferring HTML5+javascript for cross platform work.
不过,很有可能,您永远不会让单一代码库在所有平台上都运行得足够好。也许 javascript 将是最终的,因为 MS 的Bob Muglia 已经说过他们不再专注于 Silverlight,而是更喜欢 HTML5+javascript 进行跨平台工作。