Source downloaded from : http://www.libsdl.org/
INSTALL:
./configure
make
sudo make install
Test code:
#include "SDL.h" /* All SDL App''''s need this */
#include <stdio.h>
int main() {
printf("Initializing SDL./n");
/* Initialize defaults, Video and Audio */
if((SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO)==-1)) {
printf("Could not initialize SDL: %s./n", SDL_GetError());
exit(-1);
}
printf("SDL initialized./n");
printf("Quiting SDL./n");
/* Shutdown all subsystems */
SDL_Quit();
printf("Quiting..../n");
exit(0);
}
compile:
gcc -o initializing test.c -I/usr/local/include/SDL -lSDL
本文介绍了一个简单的SDL(Simple DirectMedia Layer)入门示例,演示了如何安装SDL并编写第一个SDL程序。通过本教程,读者可以了解如何配置SDL开发环境、初始化SDL以及正确退出SDL的方法。
828

被折叠的 条评论
为什么被折叠?



