I have decided that I need to learn C++ in order to properly use Urho3D. Until now I’ve done mostly shader work, and the small amount of code I needed to get those to display was in Angelscript. I checked out a book on C++ at my local library so I can understand the basics. Every time I’ve tried learning C++ prior I was on my own, no guide or anything. I never got far. I’m hoping this book will at least let me wrap my head around the language. Any other resources that you guys would recomend for learning C++? Just general C++, I am learning this to use Urho3D but it doesn’t have to directly relate to Urho. Any good websites or books that I can get easily? If you have any good tutorials please post a link to them here. Thank you for the help.
This is what I learned from, but it is pre-c++11, so it won’t be complete. Basically, I used this to get an understanding of how c++ works (syntax, pointers, etc.) but it was only through actually using it in a small- to mid-sized project and debugging all the mistakes I made that I actually learned the language.
They also have http://www.cplusplus.com/doc/tutorial/ which does include c++11 features, though I haven’t actually used these.
Thanks! I will check it out!
The great thing about C++ is that you can pretty much learn it as you need it (kinda like guitar).
When you look at other people’s work, you’ll occasionally see new things that you don’t fully understand.
This gives you a chance to play with that new feature in isolation and understand it completely, before adding it to your ever-growing “tool box” of techniques and language features.
If you ever “get stuck”, there’s literally millions of programmers around the world who are more than willing to help you - maybe not do your work/homework for you, but definitely willing to explain things and generally point you in the direction of the answer.
That being said, and even though Urho3D is exceptionally well-written and clean sourcecode, the engine codebase is quite large, and daunting for a new C++ programmer to attempt to understand.
Be patient with yourself, learning anything new has a “learning curve” which is always steepest at the beginning, and which always eases over time.
I’m currently struggling with Angelscript/C++ interop dramas.
One would think it would be trivial to call from one language to the other and back again, but there are some hurdles and pitfalls and I’m still working them all out…
Bjarne’s style in code and as an instructor appeal to me. He brings out the elegance in the rather complex language of C++.
On his site is a wealth of resources (and he will not do our homework too ).
Books? His The C++ Programming Language does cover the entire language exhaustively but other books come as recommended, some as primers or for different backgrounds. This list appears to be maintained.
A fairly complete online C++ reference.
Seconded about a good IDE and about Qt Creator as a suggestion. Letting the IDE deal with the exact spelling and capitalization (yay autocomplete) is nice when trying to figure out a language (except for the rare occasions when it tries to correct something incorrectly). To me, even more important are the nice debugging features that most IDEs provide - debugging from the console is doable, but not something I enjoy.
In the beginning you will cough your blood out, praise the gods and grimace people away. But in the end (1 to 5-10 years) you’ll be feeling proud.
But fear not. Over those lonely nights, coredump after coredump, think you’re not alone.
A Tour of C++, Bjarne Stroustrup, C11
a more neat reference:
some more when you beef up
exercises: use Urho3d
Of course, don’t lose your time with pre C11. C11 is here to stay. C before, just dying dizzy old programmers use that
(p.s. forgot about java. Die!)
Along with all of the suggestions, I cannot stress enough how important it is to learn to use a debugger. printf() is NOT an adequate debugging tool in C++, especially when your code crashes or malfunctions in bizarre ways.
You should be using breakpoints, stepping through your code and looking at stack trace/variable watches/etc.
Log::Write() are also handy (temporary) diagnosis tools.
Wish you luck. IMO anyone who wants to program should start with the basics first, C and C++ as by learning them you get an understanding of how software works in general. C is a very low level language by itself. Myself, I’ve been coding in C++ for awhile and there are still things I sometimes find in examples that I didn’t know you could do or just have never needed before, for example, being able to make your program more dynamic by mapping actual function pointers as variables. I know sounds crazy but that’s why C++ is one of the best because you are allowed to do manual manipulation of memory at the lowest levels.
C and C++ are all part of the same language. You should learn the latest C++ methodology though, as it makes things much simpler. QT is also a great library to start off with by compiling it. download the source and learn how to compile the source-code yourself.
Learn the standard STD library. Maps are all important for pretty much everything you do.
Given the learner already had a background in several script languages that feature OOP, I felt that only a “crash course” in C++ features and syntax was warranted - a total of 17 single-file examples was provided, using STL as an imposter, and we’re now ready to explore Urho - we may not be an expert C++ coder, but we now know enough to get by in Urho projects, and besides, Urho itself does not tend to use “new” features of the language, so only what was relevant was covered. Some low-level concepts, including binary enums and bitshifting and the common binary logic operators, but not much of the very top end stuff was included.
It’s impossible to compile Urho3D to a straight C++03 target, being the oldest clean target in K&R purist eyes. You just saw this with the
using usage for shadowmap blurs, which is a C++11 feature.
It’s 2019, please use texture arrays for fucks sake.
I have indicated at every step, that learning c++ can take up to ten years, and that there is more to explore on your own - I aimed for the sweet spot, and so does Urho in terms of what parts of c++ are used - particularly, I drew attention to common containers, and how Urho has a version of every container we touched on in the 17 lessons
early examples included an abstract value container…
I’ve not even touched on render tech yet, except for custom debug drawing, but I promise to use texture arrays appropriately, if or when it comes up
Texture arrays are my personal crusade. They are glory and they are versatile. They’re also more than a decade old and still under used.
An array of textures sounds useful AF to me, but something tells me it’s a bit more complex than that. Is it kinda like a megatexture in the ID tech engines?
The learner has indicated that they can already code shaders, at which point I was happy to condense the learning material to suit the needs of the learner
I have not touched on any rendering stuff yet, but some undisclosed lessons do touch on some basics - we’ll get there rapidly, once we are done playing catch-up