Welcome to the first article of Learning C++ tutorial series, provided by the IGAD program of the NHTV University! These tutorials are designed to take you from zero to block 3 entry level of IGAD's program in a somewhat smooth fashion. We start at the absolute basics: all that you need to get started is some decent equipment, a fair bit of time, and quite a bit of dedication.
Regarding dedication: These tutorials are supposed to take you anywhere between two and four hours each. Students enrolled in IGAD's program are supposed to complete two tutorials per week. That means that you have an extra workload of 4-8 hours. No-one said this was going to be easy, right?
If you need support while going through these articles, please don't hesitate to use the DevMaster.net forums. You'll have no problems getting answers to your newbie questions there. Many experts roam these forums, so chances are that your question will be answered by quickly.
A quick blurb about us: IGAD stands for "International Game Architecture & Design". We are a Dutch accredited course for game development, ran almost exclusively by teachers with game industry experience. We started in 2005, and so far, it's awesome.
This tutorial is written by Jacco Bikker, Brian Beuken, Nils Deslé, and Carlos Bott. Look us up on the internet to find out about we did and still do related to games development.
At IGAD, we develop our games primarily on PCs. The preferred development environment is Microsoft's Visual Studio 2008. If for whatever reason getting the real thing is a problem for you, you can also try Microsoft's free version, Visual Studio Express. Note however that some things may work slightly different in that version. So, while you figure out how to obtain the correct version, download a fully functional trial from Microsoft by following this link: http://go.microsoft.com/?linkid=7701859. This will get you a 3.3GB .iso file (a DVD image). You can burn this image using most DVD burning software, or, alternatively, you can mount the image using e.g. daemon tools: http://www.disk-tools.com/download/daemon.
Apart from Visual Studio, you are going to need the DirectX SDK. At the time of writing, the DirectX SDK could be obtained here: http://msdn.microsoft.com/en-us/directx/aa937788.aspx. Click the first link (March 2009 version). If that link fails, search the microsoft website for the SDK.
Note that this software will run well on XP 32-bit, Vista 32-bit and Windows 7. Using a 64-bit OS may make some things a little more complex, but you should be OK.
If you take some time now to setup Visual Studio properly, it will make your life easier. Have a look at this screenshot:
This is probably quite a bit simpler than what you have right now. To make your VS look like this, first go to Tools ==> Customize. This will open a window, but it will also allow you to drag most elements of the tool bar. Remove anything that you don't see in above screennshot by dragging it away from the tool bar. Then add the stuff that you are missing:
Close all toolboxes, explorers and windows, Close all toolboxes, explorers and windows, except for the 'Solution Explorer' (again, as in the screenshot above).
Then, change the following settings under Tools ==> Options:
You can change some things later, but at least now you know where to find them.
Before we go on:
"This is the first and only article in these series that is this boring. Starting with part 2, you will be coding, not downloading + installing + adjusting settings. Promise."
That being said, let's get coding!
From the File menu, select New, then Project:
You need to change various things in this dialog. Set the name of your project to 'part1' (or use your imagination). Set the location to c:\my_projects (so you can actually find them). Unselect 'create directory for solution'. It will create enough directories anyway. Finally, make sure you selected 'Win32' and 'Win32 Console Application'. Then click OK. In the next window, click 'Next' (not Finish). In the next window, tell VS that you want an empty project, without any ATL or MFC stuff. Now click Finish.
Your 'solution' (you didn't solve anything, but whatever) should look like the image on the right now.
Now, let's delete some stuff we don't need: Select all three folders (Header files, Resource files and Source files) and delete them. Now it's finally time to add a source file to play with. Right-click on 'part1' and select Add ==> New Item. In the dialog, select 'C++ File (.cpp)', and name it 'main.cpp' (or anything else really). Then click 'Add'. The new file is immediately opened, and we're ready for some coding.
A tutorial on C++ is not complete without a 'hello world' example, so here we go. Enter the following program:
printf( "Hello world!\n" );
You can start the program by hitting F5.
When you go to c:\my_projects\part1, you will see that VS created a large amount of files for you. The most interesting one is in the 'Debug' folder, and it's called part1.exe. When you start this application, you will see that you created it yourself.
Apart from this file, there are 'manifests', 'program databases' (pdb), 'dependencies' (dep), 'object files' (obj), a buildlog and so on. Quite confusing perhaps, but all that matters right now is the .cpp file in c:\my_projects\part and the executable that it was turned into.
Every article in this series will end with a small practical assignment. To get the most from this tutorial, you will need to complete this assignment, before you continue with the next part. Make sure to ask for help on the forums if you get stuck.
So, here's your task:
Create an executable that prints your name 10 times, then waits for a key, then prints 'IGAD rules!' 10 times, then waits for a key again, then exits.
In the next article, we will go over a project template that we will be using throughout the series. This will help to focus more on the core concepts and game development without being distracted by platform-specific details. Stay tuned!
Please log in or register to post a reply.
The links to the next articles are broken.
DevMaster: Can you please fix these broken links?
Thanks in advance.
Thanks for this tutorial … I really love it and it even work well with microsoft visual studio 2010
for the assignment :
//this is my code
printf( “Osama Osama Osama Osama Osama Osama Osama Osama Osama Osama” );
printf(“IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules! IGAD rules!”);
Can you please fix the links to part 2? they just send me back to this page.
Thank your tutorial…nh Because I don’t have the microsoft visual studio.So I want to know if I can use the microsoft visual C++6.0 to learn it?Thank you.