Jump to content

  • Log In with Google      Sign In   
  • Create Account


C/C++ Refresher


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
8 replies to this topic

#1 nitishk   Members   -  Reputation: 161

Like
0Likes
Like

Posted 08 July 2013 - 05:17 PM

I've been away from C/C++ programming for quite some time now, been doing a lot of work in Java (mostly making games) but I have made games in C in the past using SDL so it's not like I am learning a new language but I feel like if I just dove right back into it I would struggle. What would be the best way to get a quick refresher in C/C++ because I would like to start getting into some Windows API programming now. I looked up some C/C++ tutorials but they all start with very basics such as what a variable is etc. I would just like to get familiar with the syntax and language specifics quickly. What would be the best way to get started developing as fast as possible? Thanks!



Sponsor:

#2 Servant of the Lord   Crossbones+   -  Reputation: 17189

Like
3Likes
Like

Posted 08 July 2013 - 05:32 PM

How about picking up a reference guide to the latest C++ standard? (C++11)

Not only would you be reminded about how C++ looks, but you'll also be brought up to date on all the new features.

 

I haven't personally read it, but this book is an often recommended read.

 

As for Windows programming, people don't usually directly program with Win32 anymore. Usually they use a wrapper API - either from Microsoft, or a third-party one.

I recommend Qt as a great API.

 

You also mentioned that you made 'C' games in the past, but then repeatedly say C/C++. C++ is a very distinct language from C. Have you already learned C++ in the past?


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#3 nitishk   Members   -  Reputation: 161

Like
0Likes
Like

Posted 08 July 2013 - 05:49 PM

How about picking up a reference guide to the latest C++ standard? (C++11)

Not only would you be reminded about how C++ looks, but you'll also be brought up to date on all the new features.

 

I haven't personally read it, but this book is an often recommended read.

 

As for Windows programming, people don't usually directly program with Win32 anymore. Usually they use a wrapper API - either from Microsoft, or a third-party one.

I recommend Qt as a great API.

 

You also mentioned that you made 'C' games in the past, but then repeatedly say C/C++. C++ is a very distinct language from C. Have you already learned C++ in the past?

That book looks exactly like something I am looking for, I will look into it for sure!

 

Would it be better to use the Microsoft wrapper API? What is that called and how does it differ from third-party ones such as QT? I would prefer to stick with the official one by Microsoft unless there are specific advantages to using a third-party API.

 

I made 2 games (Pong and Pacman) in C only but I learned C++ shortly after and started remaking my Pong using C++ and OOP, didn't finish the game but I'd say I was fairly sufficient in C++. I would like to continue with C++ but I was unsure which would be more relevant to Windows programming.



#4 Servant of the Lord   Crossbones+   -  Reputation: 17189

Like
2Likes
Like

Posted 08 July 2013 - 06:09 PM

Would it be better to use the Microsoft wrapper API? What is that called and how does it differ from third-party ones such as QT?

The advantages of third party ones is that the code works on Windows, Mac, and Linux, and sometimes other platforms like Android, iPhone (with additional work required), instead of just working on Windows machines. Oftentimes, they're better designed than Win32 also (IMO), because Win32 has to remain backwards compatible with almost two decades of features that are deprecated, and also has to work across many different languages and so can't take advantage of certain language features. Other Microsoft APIs like DirectX do alot better, because each DirectX version has the freedom redesign itself from scratch.

 

The more modern Microsoft APIs I don't have experience with, mostly because they either use different languages (like C#) or they require you to use Microsoft's tools, or they require non-standard dependencies on Microsoft Runtimes (like .NET). Maybe someone with experience with them can comment.

I'm a huge Microsoft fan (love Microsoft Excel and Win7), but I don't like working with the Microsoft libraries I've interacted with so far - though I admittedly haven't tried too many.

 

But really, your API depends on your goals. If you're wanting to make games, consider SDL 2.0 or SFML 2.0 for 2D hardware-accelerated graphics, and input and sound.

If you want to make cross-platform desktop applications, I'd re-recommend Qt. If you're wanting to make services that run without anything visible onscreen, then pure C++ would work without a graphics API.
 

I made 2 games (Pong and Pacman) in C only but I learned C++ shortly after and started remaking my Pong using C++ and OOP, didn't finish the game but I'd say I was fairly sufficient in C++. I would like to continue with C++ but I was unsure which would be more relevant to Windows programming.


C++ is a very huge language that takes several years to master. By all means continue to explore it! But when it comes to C++, it's often better to underestimate than to overestimate your capabilities. Or maybe I'm just misunderestimating your capabilities for you. laugh.png The book I mentioned won't teach you all of C++ (no single book can), only C++'s standard library.

You'll probably want to bookmark cplusplus.com, cppreference.com, and the notable C++ FAQ as go-to sources for information.


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#5 nitishk   Members   -  Reputation: 161

Like
0Likes
Like

Posted 08 July 2013 - 06:25 PM

 

Would it be better to use the Microsoft wrapper API? What is that called and how does it differ from third-party ones such as QT?

The advantages of third party ones is that the code works on Windows, Mac, and Linux, and sometimes other platforms like Android, iPhone (with additional work required), instead of just working on Windows machines. Oftentimes, they're better designed than Win32 also (IMO), because Win32 has to remain backwards compatible with almost two decades of features that are deprecated, and also has to work across many different languages and so can't take advantage of certain language features. Other Microsoft APIs like DirectX do alot better, because each DirectX version has the freedom redesign itself from scratch.

 

The more modern Microsoft APIs I don't have experience with, mostly because they either use different languages (like C#) or they require you to use Microsoft's tools, or they require non-standard dependencies on Microsoft Runtimes (like .NET). Maybe someone with experience with them can comment.

I'm a huge Microsoft fan (love Microsoft Excel and Win7), but I don't like working with the Microsoft libraries I've interacted with so far - though I admittedly haven't tried too many.

 

But really, your API depends on your goals. If you're wanting to make games, consider SDL 2.0 or SFML 2.0 for 2D hardware-accelerated graphics, and input and sound.

If you want to make cross-platform desktop applications, I'd re-recommend Qt. If you're wanting to make services that run without anything visible onscreen, then pure C++ would work without a graphics API.
 

I made 2 games (Pong and Pacman) in C only but I learned C++ shortly after and started remaking my Pong using C++ and OOP, didn't finish the game but I'd say I was fairly sufficient in C++. I would like to continue with C++ but I was unsure which would be more relevant to Windows programming.


C++ is a very huge language that takes several years to master. By all means continue to explore it! But when it comes to C++, it's often better to underestimate than to overestimate your capabilities. Or maybe I'm just misunderestimating your capabilities for you. laugh.png The book I mentioned won't teach you all of C++ (no single book can), only C++'s standard library.

You'll probably want to bookmark cplusplus.com, cppreference.com, and the notable C++ FAQ as go-to sources for information.

 

Thanks for the detailed explanation! I think I will look into Qt and maybe some other 3rd party API for now because I do plan on releasing it for other platforms as well and the backwards compatibility seems like an unnecessary disadvantage I can overcome by simply using a more modern API.

 

I've started reading on cplusplus.com already so for now I think I'll just get myself up to speed on C++11 and then start my application development.

 

I'm curious about the part where you mentioned that programs that run in the background don't need a graphics API. What would I need for such a program? Just a simple program running in the system tray.


#6 Servant of the Lord   Crossbones+   -  Reputation: 17189

Like
2Likes
Like

Posted 08 July 2013 - 06:39 PM

I'm curious about the part where you mentioned that programs that run in the background don't need a graphics API. What would I need for such a program? Just a simple program running in the system tray.

 

Programs running in the system tray need to use Win32 or a library like Qt.

 

Programs that don't require any visuals serve many purposes. If you're on a Windows operating system, do Ctrl+Shift+Esc and switch over to the 'Processes' and 'Services' tab. How many of those programs do you see actually visible on-screen? smile.png

 

Many programs you can run from the command line, and some are very powerful. Microsoft, Linux, and Mac all have many programs built in that don't have any interface. ImageMagick is a famous one (downloadable) that lets you manipulate image files in-bulk. Many webservers have it pre-installed, but I use it on rare occasions on my Windows machine.

 

Here's another example of one: Open a command prompt (Start -> Run -> cmd.exe), and type in 'ping www.google.com' to have your computer send a network packet to Google's webservers, and measure the amount of time it takes to go there and back. 'ping' is a program built into almost every operating system. Non-visual tools like these often do one thing, and do it well, and people chain the output and input of multiple "command-line" programs to run complex tasks on bulk files. Some can be dangerous to use, though, if you accidentally ask them to delete files you didn't want deleted - I almost did that the other day. happy.png

 

Game-wise, these kinds of programs don't serve much purpose... but game servers don't have visual interfaces, and so don't need graphics APIs (They all use other kinds of APIs, though - like the built-in networking APIs most machines have, or file-access APIs, or etc...).


It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.

[Fly with me on Twitter] [Google+] [My broken website]

All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.                                                                                                                                                       [Need free cloud storage? I personally like DropBox]

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#7 nitishk   Members   -  Reputation: 161

Like
0Likes
Like

Posted 08 July 2013 - 08:08 PM

 

I'm curious about the part where you mentioned that programs that run in the background don't need a graphics API. What would I need for such a program? Just a simple program running in the system tray.

 

Programs running in the system tray need to use Win32 or a library like Qt.

 

Programs that don't require any visuals serve many purposes. If you're on a Windows operating system, do Ctrl+Shift+Esc and switch over to the 'Processes' and 'Services' tab. How many of those programs do you see actually visible on-screen? smile.png

 

Many programs you can run from the command line, and some are very powerful. Microsoft, Linux, and Mac all have many programs built in that don't have any interface. ImageMagick is a famous one (downloadable) that lets you manipulate image files in-bulk. Many webservers have it pre-installed, but I use it on rare occasions on my Windows machine.

 

Here's another example of one: Open a command prompt (Start -> Run -> cmd.exe), and type in 'ping www.google.com' to have your computer send a network packet to Google's webservers, and measure the amount of time it takes to go there and back. 'ping' is a program built into almost every operating system. Non-visual tools like these often do one thing, and do it well, and people chain the output and input of multiple "command-line" programs to run complex tasks on bulk files. Some can be dangerous to use, though, if you accidentally ask them to delete files you didn't want deleted - I almost did that the other day. happy.png

 

Game-wise, these kinds of programs don't serve much purpose... but game servers don't have visual interfaces, and so don't need graphics APIs (They all use other kinds of APIs, though - like the built-in networking APIs most machines have, or file-access APIs, or etc...).

 

Oh i understand now, I thought you meant they could be made with the standard C++ libraries which is what confused me haha. I figured I'd need some sort of API for it anyway.

 

Thank you very much for the helpful information, I know what I need to do now :D



#8 NightCreature83   Crossbones+   -  Reputation: 2674

Like
0Likes
Like

Posted 09 July 2013 - 02:03 AM

the windows API is still relevant today just read "the old new thing" or check any games code base it mostly uses the Shell functions of the windows API as that takes care of dealing with all of the UAV permissions.

 

A game always uses platform API's that it runs on, it is the engine that abstracts this away for other developers on the team, but the code underneath is platform specific and uses the correct API's. Whether that is Xbox, PS3 or Win32/64.


Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#9 MarekKnows.com   Members   -  Reputation: 436

Like
0Likes
Like

Posted 10 July 2013 - 10:51 AM

Are you wanting to build games for Windows or other platforms?  Mobile platforms have certain restrictions and some of them may not even support C/C++.  If you want to do cross platform development you could use something like Unity, but then you'd be programming in C# most likely.

 

I started off using SDL but ended up replacing all of their code with Windows API calls when building my own game engine so that I could have more control over how to manage my app and windows.


---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing, Jewel Thief





Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS