Snail: The legend is given clear, no longer translated, if you want to stay, in Application Setting, if you want to make a pop-up form, you must use the Window Applicaition option.
Welcome to the SDL TUTORALIAL!
For Visual Studio .NET
Written by
Brian davisbm@purdue.edu erik ebaar@purdue.edu
SDL VERSION IS 1.2.5 as OF Writing this Tutorial.
Browse to the lib SDL Home Page ... http://www.libsdl.org The Click on The Download -> SDL 1.2 Link.
Under The Win32 Development Libraries, Download The Latest Version of SDL-Devel VC6 Package.
Create A Directory IN C: / Named lib_sdl. This will be used to store all your include files, dll flies, and libraries.save the zip file to this directory.
Extract the zip file to the Directory, IT Should Create a folder named with the latest version of similar to this, ip.
Launch Microsoft Visual Studio .NET
Click on the Tools-> Options. Then SELECT The Projects-> VC Director. SELECT "include files" from the top right pull down and address the c: /lib_sdl/sdl-1.2.5/include directory.
Select the top right pull down menu again and choose "Library Files" Then add the directory C:. /LIB_SDL/SDL-1.2.5/lib.Now that this is done, the compiler will know where to look for SDL libraries and header Files. Thase settings area global and set as default for every new project.
Go to the file menu, and select "new-> Project".
Select The Visual C Projects Folder, And Scroll Down and Create A Win32 Project.Enter the name of the project, and the folder where you want to save it and hit ok.
SELECT "Application Settings" and Change The Application Type to Console ApplicationSelect "Empty Project" Under Additional Options.
Right-click on the name of your project in the Solution explorer and select "Properties" .Select the "code Generation" on the left. On the right, select the "Runtime Library" pull down menu and choose Multi-Threaded DLL or Multi -Threaded debug dll if you wish to use debugging. Hit OK.
Right Click On The Project Name In The Solution Exploer, and SELECT "Add-> Add New Item ...".
SELECT C File and name it main, and hit open.
Copy and paste this source code or manually type it in to the main.cpp file.
/ * - Include the precompiled libraries - * /
#ifdef Win32
#pragma comment (Lib, "SDL.LIB")
#pragma comment (lib, "sdlmain.lib")
#ENDIF
#include "sdl.h"
INT main (int Argc, char ** argv)
{
Printf ("/ NHELLO SDL User! / N");
/ * Initialize SDL * /
IF (SDL_INIT (SDL_INIT_VIDEO) <0)
{
FPRINTF (stderr, "Video Initialization Failed:% S / N",
SDL_GETERROR ());
SDL_QUIT ();
}
SDL_QUIT ();
Return 0;
}
Select the "build" Menu and choield "build solution"
You need to copy the SDL.dll file from the lib directory (C: /LIB_SDL/SDL-1.2.5/lib) to your Debug directory where your freshly bulit executable now lays (c: / SDL_Test / SDL_Test / Debug) so the Program May Run.
From The Windows Menu, Click "Run" and Type CMD, The Hit The Open Button To Open A Command Window. You will Use this to run your app information.
Use cd to change to your directory: CD C: / SDL_TEST / SDL_TEST / DEBUG, THEN TYPE SDL_TEST.EXE AND HIT ENTER!
Congratulations! You have successfully written, compiled, and run your first SDL program. While this does not use any SDL code, it does show that SDL is successfully installed. You must change the project properties, include the libraries in the code, and copy the dll for every project you make. Use the documentation available on http://sdldoc.csn.ul.ie/ or from the www.libsdl.org main site to create your first programs! Enjoy! Back to thePurdue Game Development Club