Make great things

What I cannot create, I do not understand.

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Hello World for SDL2

SDL2 setting for visual studio.

http://lazyfoo.net/tutorials/SDL/01_hello_SDL/windows/msvsnet2010u/index.php

 

 

1. SDL_Init( SDL_INIT_VIDEO );

2. window = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );

3. screenSurface = SDL_GetWindowSurface( window );

4. SDL_FillRect( screenSurface, NULL, SDL_MapRGB( screenSurface->format, 0xFF, 0xFF, 0xFF ) );

5. SDL_UpdateWindowSurface( window );

6. SDL_DestroyWindow( window );

 

The above five line code will create a SDL window and create a surface from this window, than we fill this surface with color(0xff, 0xff, 0xff) and update this window use the surface we create before, finally we just destroy the window and return this program

posted on 2014-04-10 14:50  wbin91  阅读(518)  评论(0编辑  收藏  举报