简体   繁体   English

从AS3学习C ++

[英]Learning C++ from AS3

I'm a decent AS3 programmer. 我是一个不错的AS3程序员。 I work in games, and that is my reason for programming. 我在游戏中工作,这是我编程的原因。 While there is much I can accomplish with Adobe AIR, my understanding at this point is that learning C++ is probably a good direction to take. 虽然我可以用Adobe AIR完成很多工作,但我在这一点上的理解是学习C ++可能是一个很好的方向。 I would learn a lot of valuable lower level programming if I needed it down the road, and I would have an easier time learning other C oriented languages. 如果我需要的话,我会学到很多有价值的低级编程,而且我会更容易学习其他面向C语言。 I see a lot of information for people looking to learn AS3 who know C++, but not the other way around. 我看到很多人希望学习AS3谁知道C ++,但不是相反。

Why C++? 为什么选择C ++? Cross platform compatibility is important to me, so I'm not particularly interested in C# or Objective-C at this junction. 跨平台兼容性对我很重要,所以我对此结点的C#或Objective-C不是特别感兴趣。 I'm also aware of Haxe, and while I love the concept, after doing some research I'm worried about investing a lot of time into something so recent with limited learning resources and documentation. 我也知道Haxe,虽然我喜欢这个概念,但在做了一些研究之后,我担心在学习资源和文档有限的情况下投入大量时间。

I'm looking for advice and resources (books, articles) related to this topic. 我正在寻找与此主题相关的建议和资源(书籍,文章)。 Thanks in advance! 提前致谢!

I don't think you're going to find much help that is tailored to people that know AS3 looking to learn C++. 我认为你不会找到那些知道AS3想要学习C ++的人的帮助。 It's a bit too specific. 这有点太具体了。

Essentially, your AS3 experience will help with your general ability to program, formulate algorithms and classes, but very little of it is relevant to the way C++ works. 从本质上讲,您的AS3经验将有助于您编程,制定算法和类的一般能力,但很少与C ++的工作方式相关。

As such, the best I can offer is what others have offered before. 因此,我能提供的最好的是其他人之前提供的。 These are a couple of threads with links to good resource: 这些是一些线程,链接到良好的资源:

What is the best source to learn C++? 学习C ++的最佳来源是什么?

What is the best way to learn C++ if I have a bit of other programming experience? 如果我有一些其他的编程经验,学习C ++的最佳方法是什么?

In general, I'm against any tutorials that try to teach a language in terms of another; 一般来说,我反对任何尝试用另一种语言教授语言的教程; it's like to trying to learn a new foreign language by translating every word -- it just doesn't work. 它试图通过翻译每个单词来学习一门新的外语 - 它只是不起作用。 You have to learn a language in its own terms to fully appreciate it. 你必须用自己的语言学习一门语言才能完全理解它。

About Haxe: I personally see no risk in using it. 关于Haxe:我个人认为没有使用它的风险。 I completely switched to Haxe from AS3 about 9 months ago, and I feel it was a very good decision. 大约9个月前我完全从AS3切换到Haxe,我觉得这是一个非常好的决定。 AS3 has completely stalled since its release. AS3自发布以来已完全停滞不前。 Sure, the player API has grown, but the language itself hasn't evolved, except for the introduction of typed vectors. 当然,播放器API已经增长,但语言本身并没有发展,除了引入类型向量。

While I feel that your general concern towards Haxe is unjustified, I have to point out, that Haxe/CPP is a different beast. 虽然我觉得你对Haxe的普遍关注是不合理的,但我必须指出,Haxe / CPP是一个不同的野兽。 Although the project is very promissing and ambitious, it does have its problems. 虽然该项目非常有希望和雄心勃勃,但确实存在问题。 Many cool Haxe features are translated into C++ with serious overhead (although in performance critical situations you can simply avoid them). 许多很酷的Haxe功能都被转换为C ++并且开销很大(尽管在性能危急情况下你可以简单地避免它们)。 Also the resulting code is really not nice to read, debugging is not really obvious (you can debug the code, but you than have to fix the problem in the original Haxe source) and there is no canonical way of using the Haxe output from C++ in a decent way. 此外,生成的代码真的不好读,调试不是很明显(你可以调试代码,但你不必修复原始Haxe源代码中的问题)并且没有使用C ++的Haxe输出的规范方法以一种体面的方式。 And the C++ platform is known to have minor quirks, although it has become reasonably stable. 众所周知,C ++平台虽然已经变得相当稳定,但却存在细微的怪癖。

The question is now, what exactly you're trying to achieve learning C++. 现在的问题是,你究竟想要学习什么来学习C ++。 Haxe/CPP is a decent way to use a high level language getting about the same performance as C++, while staying even more cross platform. Haxe / CPP是使用高级语言获得与C ++相同性能的一种不错的方式,同时保持更多的跨平台。 IMHO, from an AS3 point of view, the most interesting thing about C++ is its low level access and the templates, both of which are very powerful aspects. 恕我直言,从AS3的角度来看,关于C ++最有趣的事情是它的低级访问和模板,这两者都是非常强大的方面。

To me, AS3 is basically a poor man's Java, except for the mostly unused dynamic and functional traits. 对我来说,AS3基本上是一个穷人的Java,除了大多数未使用的动态和功能特征。 Thus, if you are determined to learn C++, I would suggest, you try learning C++ from Java . 因此,如果您决定学习C ++,我建议您尝试从Java学习C ++

I know this is an old question but, oh well: 我知道这是一个老问题,但是,哦,好吧:

Pick up a copy of " Programming Principles and Practice using C++ " by Bjarne Stroustrup, the inventor of C++. 拿起C ++的发明者Bjarne Stroustrup撰写的“ 使用C ++编程原理和实践 ”的副本。 Your story sounds almost exactly the same as mine. 你的故事几乎与我的故事完全一样。 I started out as an AS3 developer and this gave me a real love for development all together, but I realize that ultimately if I wanted to truly be able to express my artistic visions with the utmost power and portability that there was no question, C++ was the way to go. 我最初是一名AS3开发人员,这让我真正热爱发展,但我意识到,如果我真的能够以最大的力量和便携性来表达我的艺术愿景,那么毫无疑问,C ++是要走的路。 Having ventured down that road, I was 100% right. 冒险走下这条路,我100%正确。 I tried Java and other various languages and you just cant compare the power and features (sometimes one in the same) of C++. 我尝试过Java和其他各种语言,你只是无法比较C ++的功能和特性(有时是同一个)。

That said, everything you've learnt in AS3 will most likely not help you whatsoever . 也就是说, 你在AS3中学到的一切很可能对你没有任何帮助 It is an entirely different world all together. 这是一个完全不同的世界。 Literally the ONLY thing the two languages have slightly in common is in syntax when dealing with vectors. 从字面上看,两种语言在处理向量时的语法略有共同点。 You declare a vector and its type by saying vector<myType> . 通过说vector<myType>声明一个向量及其类型。 That is absolutely it. 绝对是这样。

So, my advice is to just delve into C++ and the book I mentioned is perfect, it assumes not only that you know nothing about C++ but that you also know nothing about programming. 所以,我的建议是深入研究C ++,我提到的这本书是完美的,它假设你不仅对C ++一无所知,而且你对编程也一无所知。 And honestly, not to insult (remember, I was there too) but if you came from a background in just AS3 then you really do know nothing about programming. 老实说,不要侮辱(记住,我也在那里),但如果你来自AS3的背景,那么你真的对编程一无所知。 :) This will help you see clearly the distinction between a programmer and a "developer" aka scripter. :)这将帮助您清楚地看到程序员和“开发人员”又称脚本编写者之间的区别。 All the best! 祝一切顺利!

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

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