Jump to content
  • Advertisement
Sign in to follow this  
Skizi

Help with a book

This topic is 3688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Over the past 5-7 months I've been learning C++, and so far I think I'm doing pretty good(at least that's what I tell myself). I've got most of the fundamentals down, and I've learned to incorporate most main functions and commands to make programs run properly. I understand how the 3 loops work, how to use arrays and vectors, if/if else/ else statements and more. The book "Beginning C++ through game programming" by Michael Dawson really helped my with this language, but now that I'm done with the basics I want to start learning graphical libraries and maybe even start working on pong/ breakout clones. I'm going to start with Allegro, and I already have it installed. The problem is I have the "Game programming all in one" book by J. Harbour that explains the Allegro very well and I'm loving the book, but I just found out yesterday it uses the regular C language. C and C++ looked almost identical to me until I started seeing printf, getch() and other unknown statements. My question is, should I continue reading this book even though I don't want to learn the C language? Is it really that different, or can I just substitute some C++ commands for the C ones that I know even though it's starting to confuse me? Can anyone recommend other good books that use Allegro and C++?

Share this post


Link to post
Share on other sites
Advertisement
In my opinion, the best thing to do in that situation is to learn the general concepts being taught and abstract them from the specific language/constructs used to demonstrate the concepts.

That can be tricky for a beginner but the fact that you already notice C style functions and don't want to mix and/or confuse C and C++ is a good sign.

Share this post


Link to post
Share on other sites
Quote:
My question is, should I continue reading this book even though I don't want to learn the C language?
On the basis of it using C? Since Allegro is a C library, it's not surprising that and documentation and reference might be in C. If you're going to use a C library, be prepared to deal with C.

Quote:
Is it really that different, or can I just substitute some C++ commands for the C ones that I know even though it's starting to confuse me?
As in, is the difference between C and C++ the names of the functions? No, it's far more than that. That's why C and C++ are considered two very different languages, even though C++ shares a subset of C.

Then again, if C code looks very identical to C++ code to you, then you probably learned the C-ish way of using C++.

Share this post


Link to post
Share on other sites
Thanks for the replies.

Alright, so I'm going to be forced to learn the C language along with C++ when I start learning any graphical library?
I want to take learning slow and steady so that I understand every chapter. I know I may one day have to learn the C language, but I hope by then I am comfortable with C++ and can use it to the best of my ability.

Do you recommend switching to a different library that is written in C++(is there a lib that is written solely in C++?) And is there a good book out there that explains it?

Share this post


Link to post
Share on other sites
Quote:
Alright, so I'm going to be forced to learn the C language along with C++ when I start learning any graphical library?
If you have a C library to work with, then it presents a C interface. The thing is, C++ has a C subset to it. That’s how you can use a C library from C++. So when you are writing code, you still write C++ code.

The reason I bring up the C language is that, with a C library you might see documentation and books that themselves use C (not very surprising, right?). If you know the C subset of C++, you won’t have much trouble reading C documentation. But you need to recognize that said documentation or book will use C idiomatic code. You might not have better options.

Quote:
Do you recommend switching to a different library that is written in C++
Not necessarily. I was going to suggest SFML. But it is a relatively new library, so the documentation for it is going to be a lot more sparse than for Allegro. Then again, nicer C++ interface…I guess you could try SFML, and see if you can make sense of it. If not, you already have the Allegro book, so you don’t lose anything.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!