Chinaunix首页 | 论坛 | 博客
  • 博客访问: 3967037
  • 博文数量: 366
  • 博客积分: 9916
  • 博客等级: 中将
  • 技术积分: 7195
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-29 23:27
个人简介

简单!

文章分类

全部博文(366)

文章存档

2013年(51)

2012年(269)

2011年(46)

分类: LINUX

2012-12-28 23:22:00

1、测试代码

  1. #include <stdbool.h>
  2. #include "SDL.h"

  3. const int WINDOW_WIDTH = 640;
  4. const int WINDOW_HEIGHT = 480;
  5. const char* WINDOW_TITLE = "SDL Start";

  6. int main(int argc, char **argv)
  7. {
  8.    SDL_Init( SDL_INIT_VIDEO );

  9.    SDL_Surface* screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0,
  10.       SDL_HWSURFACE | SDL_DOUBLEBUF );
  11.    SDL_WM_SetCaption( WINDOW_TITLE, 0 );

  12.    SDL_Event event;
  13.    bool gameRunning = true;

  14.    while (gameRunning)
  15.    {
  16.       if (SDL_PollEvent(&event))
  17.       {
  18.          if (event.type == SDL_QUIT)
  19.          {
  20.             gameRunning = false;
  21.          }
  22.       }
  23.    }

  24.    SDL_Quit();

  25.    return 0;
  26. }

2、编译

  1. $ gcc -o test test.c `sdl-config --cflags --libs`



相关教程可参考:
阅读(2026) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~