- 论坛徽章:
- 0
|
一个个简单SDL程序,运行的时候出现错误:
"Fatal signal: Segmentation Fault (SDL Parachute Deployed)"
我用的是SDL-devel-1.2.8-1
运行别的Linux游戏一点问题都没有
就是我自己写的这个不行
谁能帮忙看看
谢谢了
- #include "../my.h"
- #include <SDL/SDL.h>;
- void print_Color(SDL_Color *c)
- {
- printf("--SDL_Color--\n");
- printf("SDL_Color->;r:%d\n", c->;r);
- printf("SDL_Color->;g:%d\n", c->;g);
- printf("SDL_Color->;b:%d\n", c->;b);
- printf("SDL_Color->;unused:%d\n", c->;unused);
- printf("--end SDL_Color--\n");
- }
- void print_Palette(SDL_Palette *p)
- {
- printf("--SDL_Palette--\n");
- printf("SDL_Palette->;ncolors:%d\n", (*p).ncolors); // can not use, I don't know why
- printf("SDL_Palette->;colors->;:\n");
- print_Color(p->;colors);
- printf("--end SDL_Palette--\n");
- }
- void print_PixelFormat(SDL_PixelFormat *pf)
- {
- printf("--SDL_PixelFormat--\n");
- printf("SDL_PixelFormat->;palette->;:\n");
- print_Palette(pf->;palette);
- printf("SDL_PixelFormat->;BitsPerPixel:%d\n",pf->;BitsPerPixel);
- printf("SDL_PixelFormat->;BytesPerPixel:%d\n",pf->;BytesPerPixel);
- printf("SDL_PixelFormat->;Rmask:%d, Gmask:%d, Bmask:%d, Amask:%d\n",pf->;Rmask, pf->;Gmask, pf->;Bmask, pf->;Amask);
- printf("SDL_PixelFormat->;Rshift:%d, Gshift:%d, Bshift:%d, Ashift:%d\n",pf->;Rshift, pf->;Gshift, pf->;Bshift, pf->;Ashift);
- printf("SDL_PixelFormat->;Rloss:%d, Gloss:%d, Bloss:%d, Aloss:%d\n",pf->;Rloss, pf->;Gloss, pf->;Bloss, pf->;Aloss);
- printf("SDL_PixelFormat->;colorkey:%d\n",pf->;colorkey);
- printf("SDL_PixelFormat->;alpha:%d\n",pf->;alpha);
- printf("--end SDL_PixelFormat--\n");
- }
- void print_VideoInfo(SDL_VideoInfo *vi)
- {
- printf("--SDL_VideoInfo--\n");
- printf("SDL_VideoInfo->;wm_available:%d\n",vi->;wm_available);
- printf("SDL_VideoInfo->;blit_hw:%d\n",vi->;blit_hw);
- printf("SDL_VideoInfo->;blit_hw_CC:%d\n",vi->;blit_hw_CC);
- printf("SDL_VideoInfo->;blit_hw_A:%d\n",vi->;blit_hw_A);
- printf("SDL_VideoInfo->;blit_sw:%d\n",vi->;blit_sw);
- printf("SDL_VideoInfo->;blit_sw_CC:%d\n",vi->;blit_sw_CC);
- printf("SDL_VideoInfo->;blit_sw_A:%d\n",vi->;blit_sw_A);
- printf("SDL_VideoInfo->;blit_fill:%d\n",vi->;blit_fill);
- printf("SDL_VideoInfo->;video_mem:%d\n",vi->;video_mem);
- printf("SDL_VideoInfo->;vfmt->;:\n");
- print_PixelFormat(vi->;vfmt);
- printf("--end SDL_VideoInfo--\n");
- }
- int main(int argc, char* argv[])
- {
- SDL_VideoInfo *vi;
- SDL_Surface *screen;
- int init_t = SDL_INIT_VIDEO | SDL_INIT_CDROM | SDL_INIT_TIMER | SDL_INIT_EVENTTHREAD;
- atexit(SDL_Quit);
- printf("Game Start...\n");
- if (SDL_Init(init_t) < 0) {
- fprintf(stderr, "SDL_init error\n");
- return 1;
- }
- if ((vi = (SDL_VideoInfo *)SDL_GetVideoInfo()) == NULL) {
- printf("SDL_GetVideoInfo() error\n");
- return 1;
- }
- print_VideoInfo(vi);
- printf("Exit.\n", argv[0]);
- return 0;
- }
复制代码 |
|