LearningSDL011
.pdfDecember 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 37 - Component selection screen
Select the components that make sense. I suggest you take the defaults.
Figure 38 - Start Menu Folder name dialog box
Click Next> to accept the default start menu folder name
31
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 39 - Install location dialog box
I installed under C:\Dev-Cpp instead of the default C:\Program Files\Dev-Cpp due to problems that came up under some Windows Vista installations. I suggest you take the default if you are sure you will not encounter similar problems. Click on ―Install‖
Figure 40 - message box prompt to obtain latest devpaks
If you prompted to download the latest devpaks, click on ―Yes‖.
32
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 41 - Installation progress bar
Click ―Close‖ once the installation completes
Figure 42 - Install for all users dialog box
Click ―Yes‖
2.Copy the directory folder C:\SDL-1.2.14\include\SDL to a new \SDL include directory under C:\Dev-Cpp\include. This will make it easy for the compiler to locate the SDL header files.
33
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 43The result of copying /include/SDL under Dev-Cpp include directory
3.Copy the *.a files (libSDL.dll.a,libSDLmain.a) in C:\SDL-1.2.14\lib to C:\Dev-Cpp\lib directory.
4.Copy SDL.dll under C:\SDL-1.2.14\bin to Dev-Cpp bin directory.
a.This will allow the IDE to find the SDL.dll when you execute from the IDE, otherwise you will always have to copy the SDL.dll into the same directory as the exe file.
5.Open WxDev-C++. The next couple of screen only occur when you start wxDev-C++ for the first time.
34
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 44 - Selecting language dialog box
Select the language and click > Next.
Figure 45 - Using a cool feature
Click > Next
35
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 46 - Creating a cache dialog box
Click > Next. It will take a while to parse the files.
Figure 47 - Final installation dialog box
Click OK
36
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 48 - Your first "tip of the day"
I always read the ―Tip of the day‖ in order to learn something new about the application I am using.
6. Open a new Project by selecting File | New | Project
Figure 49 - New Project dialog box
7.Select ―Console Application‖ from the list project type icons and enter a name for your Project.
8.Copy the program in Error! Reference source not found. into the default main.cpp program that as created for you when you selected Console program.
9.Add the following under: Project | Project Options. Select Parameters tab: In
37
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
-mwindows -lmingw32 -lSDLmain -SDL
C:\Dev-Cpp\lib\libmingw32.a C:\Dev-Cpp\lib\libSDL.dll.a C:\Dev-Cpp\lib\libSDLmain.a
Figure 50 - Saving the "main.cpp" file
Save the program file main.cpp
Figure 51 - Result of compiling and running the program
10. Compile and Run.
38
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Creating a WxDev-Cpp SDL template file
You can easily create a WxDev-Cpp SDL template file to use.
Open up the last project if it is not already opened.
Select File | New and select Template
Figure 52 - New Template dialog box
Click on the ―Empty Template Icon‖ and then click Library
39
December 15, 2011 [LEARNING SDL – A BEGINNER’S GUIDE]
Figure 53 - Selecting template Icon
Double click on any icon you want.
Click on Empty New Project icon and select any icon (the same one?)
If you want more of a selection you can go online and obtain free icons to use.
Click ―Create‖
You can now easily create Simple SDL Project by selecting it from the Multimedia tab when you start with File | New | Project
Figure 54 - Creating a Simple SDL Project
40