How to Create a C++ Graphics Application

Step 1 Download the graphics libraries.

The ccc files written by Cay Horstmann are available on our website:
http://www.math.ucla.edu/~wittman/10a.1.10w/ccc/index.html
Download the ccc_graphics.zip file to a convenient place, like the Desktop.

Step 2 Unzip ccc_graphics.zip.
Right-click on the file you just downloaded and select “Extract to…” You can save them
in the same place, we’ll move them later anyways. You should get 5 files:
ccc_win.h, ccc_msw.cpp, ccc_msw.h, ccc_shap.cpp, ccc_shap.h
In our code, we only include the file “ccc_win.h”. But ccc_win uses the other files, so we
have to move all 5 files as a group.

Step 3 Create a new windows project.
• As usual, start up Visual Studio and under the “File” menu click “New Project”.
On the first screen that appears, select the category “Win 32” on the left and
“Win32 Project” on the right. (Not Console Project!)
• Give the project a name, like “graphics”. Select an easy location to save it, like
the Z: drive.
• Click “OK”.
• On the next screen, click “Application Settings”. Then check the box “Empty
Project”, as we usually do. Select “Windows application”. (Not console
application!) Click “Finish”.

Step 4 Set the character code.
In the Solution Explorer, right-click on the project icon
(second from the top). In the pop-up menu, select
“Properties”.
In the window that pops up, select “Configuration Properties => General”. Select the
“Character Set” property by clicking on it and change the value to “Not Set”.

Step 5 Create a new source file.
In the Solution Explorer menu on the side, right-click on “Source Files” folder. In the
pop-up menu, select “Add => New Item…” Select “C++ file (.cpp)” and give your cpp file
a good name, such as graphics1. Click “Add”.

Step 6 Move the ccc files to the same directory as your source file.
Step out of Visual Studio for a moment. Now locate the 5 ccc files you unzipped and
move (or copy) all 5 files to the same directory as the cpp file you just created. This
way, Visual Studio knows exactly where to look for the new library. Go back to Visual
Studio.

Step 7 Add the ccc files to your Header Files.
In the Solution Explorer on the side, right-click on “Header Files”. Select “Add => Add
Existing Item”. (The libraries are already written for us, so we’re not adding a new item.)
Select all 5 ccc files and click “Add”.
You are now ready to start typing in your C++ code. Compile and run your programs as
before. You should repeat these steps for every graphics application you create,
including HW3. In particular, you have to put copies of the 5 ccc files into each folder
that contains a graphics cpp file.