Last Updated 2/18/12In this tutorial you're going to learn to set up SDL_image. If you know how to set up this extension, you can set any of them up.
SDL_image is located on this page.
Also, always make sure that when you get an SDL extension (SDL_image, SDL_ttf, SDL_mixer, etc) that you also get the newest version of SDL.New versions of the SDL extensions don't like old versions of SDL.If you don't, Dev C++ will compile the program but the program will complain at run time (it's typically something about an entry point).
Use Visual Studio Code on Ubuntu Linux to develop games using C/C, SDL 2, and OpenGL. How to set up VSCode on Linux for SDL2 and OpenGL game development c Visual Studio Code on Linux is a great way to make games using C, SDL2, and OpenGL.
Open Dev-C - Tools - Compiler Options. Check the box and add in these parameters exactly: -lmingw32 -lSDLmain -lSDL. That's 'dash L' not 'dash one'. You can just copy &. Order Dev-C & al. All the software originally found on this website are available for purchase on a single CD. Mac os sierra installer download dmg. Most of these software were developed for Windows 95, 98, NT, 2000 and XP systems. This CD includes: Dev-C 5 (versions 184.108.40.206 to latest 220.127.116.11) Dev-C 4 and 5 Packages (SDL, wxWindows, DirectX, GTK, OpenGL and many more). The lessons will use SDL & Dev-C to create a 2D game step by step for beginner. It will show you how to use font ttf, play music & sound, animation, create an object in your game. SDL talks to the hardware directly and has a surprising amount of optimisation. Converting the surface to a texture, presumably involves blitting, which means copying a substantial amount of memory. However, it seems that in this case at the time of writing this, there is absolutely no difference at all.
Every extension libary has 3 essential parts:
- The header file.
- The lib file.
- The *.dll file(s)
Open up the zip archive and there should be a folder inside.
Open the folder and it'll contain 2 subfolders.
2)First, open the include subfolder in the archive and you should seea header file. Put that header file in the directory with all the other header files in the SDL folder youextracted in lesson 1.
For example, I extracted the SDL version 1.2.12 folder to 'C:', so I put the SDL_image.h (or SDL_ttf.h orSDL_mixer.h) header in C:SDL-1.2.12includeSDL.
3)Now find the lib folder from the archive. Take the library file(s) from the archive and put them with the rest of the SDL library files.In my case the rest of the SDL library files were in C:SDL-1.2.12lib.
C++ Sdl With Dev C++ KeyboardFor certain versions of SDL_image, there will be a x86 folder and a x64 folder inside of the lib folder from the archive. The x86 folder contains the 32bit *.lib filesand the x64 bit folder contains the 64bit versions of the library files. If you're compiling a 32bit program, copy the library file(s) from the x86 folder and if you'recompiling a 64bit version copy the library file(s) from the x64 folder. By default most compilers compile in 32bit so if you're not sure how you're compiling, try the 32bitlibraries first. What matters here is not whether you have 32/64bit windows, but what type of program you're compiling.
If you don't see a x86 or x64 folder inside of the lib directory from the archive, just copy the library file(s) from the lib folder from the archive.
4)Now extract all of the *.dll file(s) from the archive and put them inthe same directory as your exe.
Like before, you can copy them to C:WINDOWSSYSTEM32 (or C:WindowsSysWOW64 on 64bit Windows) so your SDL appwill find the *.dll(s) even if they're not in the same directory. The problem with this method is if you havemultiple SDL apps that use different versions of SDL, you'll have version conflicts. If you have an old versionin SYSTEM32 when the app uses the new version you're going to run into problems. Generally you want to have yourthe *.dll(s) in the same directory as your executable developing and you'll always want to have *.dll(s) inthe same directory as the exe when distributing your app.
5)Now open up your SDL project and go to the project options.
C Sdl With Dev C Compiler
6)Under the Parameters tab, paste:
-lSDL_imagein the linker after '-lmingw32 -lSDLmain -lSDL'.
If you were linking SDL_ttf you'd put
-lSDL_ttfif you were linking SDL_mixer you'd put
7)To use SDL_image make sure to include the header file.
#include 'SDL/SDL_ttf.h'If you were setting up SDL_mixer you'd put
#include 'SDL/SDL_mixer.h'etc, etc.
Now the extension library is all set up.
Dev C++ For Mac
The main one you want to know about is IMG_Load().
From this tutorial on, PNG image files will be the primary image format used. PNGs have excellent lossless compression.
I highly recommend that you download the documentation for SDL_image and keep it handy.
It can be found here.
Previous TutorialNext Tutorial