Monday, November 4, 2013

How to install SDL?

[This process was accomplished using Ubuntu 12.04 LTS + NetBeans 7.3.1]

First, you need to install the sdl library. Just go through the terminal:
sudo aptitude install libsdl1.2-dev

For others OS, look at here:
http://lazyfoo.net/SDL_tutorials/lesson01/index.php


To set up on Netbeans:
On the project you want to use it, go to "Project Properties -> Build -> Linker -> Libraries -> Add Option -> Other option ", and enter:
-lSDL

More on:
http://forums.netbeans.org/topic41614.html
http://forums.netbeans.org/post-29474.html


For other IDEs, look at here:
http://lazyfoo.net/SDL_tutorials/lesson01/linux/index.php


To test if it worked, run the following code:
#include "SDL/SDL.h"
int main( int argc, char* args[] ) {
 SDL_Init( SDL_INIT_EVERYTHING ); //Start SDL
 SDL_Quit(); //Quit SDL
 return 0;
}  


Installing SDL Extensions:

to load images of various extensions
sudo aptitude install libsdl-image1.2-dev
 
to work with fonts
sudo aptitude install libsdl-ttf2.0-dev

to work with 16-bit sounds
sudo aptitude install libsdl-mixer1.2-dev

For other OS:
http://lazyfoo.net/SDL_tutorials/lesson03/index.php

Set up on Netbeans:
On the project you want to use it, go to "Project Properties -> Build -> Linker -> Libraries -> Add Option -> Other option ", and enter:
-lSDL_image 
-lSDL_ttf
-lSDL_mixer 

You need to add the header files to the project:

#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
#include "SDL/SDL_mixer.h" 

Done! 

No comments:

Post a Comment