![]() Screen = SDL_SetVideoMode(440, 360, 0, SDL_ANYFORMAT) įprintf(stderr, "The window could not be opened!\n") SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) This pointer must be saved for future use. One in the first parameter and will use the received surface for any drawing operation. The SDL_Surface type is a drawing surface: every drawing function expects SDL_SetVideoMode() returns a pointer to an SDL_Surface. ( SDL_ANYFORMAT means to accept any settings the Important, a zero value is fine the fourth one is related to the graphics subsystem, The third parameter is related to the colour depth – not Then the program creates a window of 440×360 pixels by calling SDL_SetVideoMode(). Thus the parameter is SDL_INIT_VIDEO (later we will need Our first program uses the graphics subsystem only, SDL has several subsystems (graphics, sound, timerĮtc.). The SDL must be initialized first, call the SDL_Init()įunction. The program below draws a few circles then waits until the user clicks the X to close it. After restarting Code::BlocksĪ new kind appears in the „New Project” list: InfoC SDL. The files of this zip should be copied into C:\Program Files\CodeBlocks\share\CodeBlocks\templates\wizard, make sure to overwrite the original config.script filed found there. There is one more thing to do to create a new SDL template wizard. „Current Variable” to create it.) Browse to C:\Program Files\CodeBlocks\MinGW in the (If there is no such option click „New” in the line of At „Current Set” select „default”, below at „Current Variable” select „sdl”. Start Code::Blocks, then select „Settings/Global variables…”. And the files in lib should be copied to C:\Program Files\CodeBlocks\MinGW\lib.Files in include should be copied to C:\Program Files\CodeBlocks\MinGW\include.Files in bin should be copied to C:\Program Files\CodeBlocks\MinGW\bin.There are three further folders in it: bin, include and lib. The provided files and description works for Code::Blocks 16.01 or newer. If you installed Code::Blocks with MinGW then installing SDL is a simple copying of a few files. Then, to the project's Linker General section, I added to the Additional Library Directories "C:\Libraries\SDL\VisualC\SDL\Release" so it could find SDL2.lib. In the SDL2_image project's C/C++ General Additional Include Directories, I added "C:\Libraries\SDL\include". I opened C:\Libraries\SDL_image\VisualC\SDL_image.sln. Then, also on 2/12/13, I used HG to get SDL_image via "hg clone ". ![]() This error is removed by adding "C:\Program Files\Microsoft DirectX SDK (June 2010)\Include" to the project's C/C++ General Additional Include Directories. It gives me an error "Cannot open include file: 'dxsdkver.h'". I set the active target to Release, and built the SDL2 project. I opened C:\Libraries\SDL\VisualC\SDL_VS2008.sln. On 2/12/13, I used HG to get SDL via "hg clone ". I am using MS Visual Studio 2008 and my OS is Windows XP, SP 2. I'm having problems getting SDL2_image to load jpgs and pngs (but it loads bmps fine). My guess is I missed a simple step to enable jpgs and pngs, but I can't seem to figure out what it is. Though showimage.cpp uses IMG_LoadTexture, IMG_Load also fails to load. In the command prompt, I navigate to C:\Libraries\SDL_image\VisualC\showimage\Release\showimage.exe and I run it such as "showimage.exe TestBMP.bmp", "showimage.exe TestJPG.jpg", and "showimage.exe TestPNG.png". As far as I'm aware, showimage.exe should be working fine now. To run showimage.exe, adjacent to the exe I added SDL2.dll and SDL2_image.dll (which I built in step 1 and 2). I also added to the project's C/C++ General Additional Include Directories a reference to "C:\Libraries\SDL\VisualC\SDLmain\Release" so it could find SDL2main.lib. To the showimage project, like before I added references to "C:\Libraries\SDL\include" and "C:\Libraries\SDL\VisualC\SDL\Release".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |