[问题]安装SDL?
发表于 : 2007-09-29 11:22
最近计算机图形学老师让我们在TC下图形编程[就是画圆,直线...]
在Linux下该用什么替换呀,安装SDL?怎么配置呀...?
Help
我现在有 build-essential 了..
在Linux下该用什么替换呀,安装SDL?怎么配置呀...?
Help
我现在有 build-essential 了..
能不能详细点啊,我是新手...windwiny 写了:openGL
freeglut3
代码: 全选
#include <stdlib.h>
#include <SDL/SDL.h>
int main() {
SDL_Surface *screen;
Uint32 color;
if ( SDL_Init( SDL_INIT_VIDEO) < 0 ) {
fprintf(stderr, "无法初始化SDL: %s\n", SDL_GetError());
exit(1);
}
screen = SDL_SetVideoMode(1280, 800, 24, SDL_SWSURFACE); /*640 X 480 X 16位色*/
if ( screen == NULL ) {
fprintf(stderr, "无法设置640x480x16位色的视频模式:%s\n", SDL_GetError());
exit(1);
}
atexit(SDL_Quit);
int i;
int width,height;
for ( i = 0; i < 256; i++) {
width=rand()%1280;
height=rand()%800;
color = SDL_MapRGB(screen->format, rand()%256, (i*i)%256, rand()%256); /*蓝色*/
SDL_FillRect(screen, &screen->clip_rect, color); /*整个屏幕填充颜色*/
SDL_UpdateRect(screen, width,height,rand()%1280, rand()%800); /*update screen*/
/*
SDL_Delay(5);
*/
printf("%d\n",i);
}
//SDL_Delay(5000); /*Delay for 5 seconds*/
}
没有那种 dos 类的api tc还是16位的 你们老师也真够古董的weilichun 写了:有没有类似TC下图形函数啊,line,circle...