sdl显示一张bmp图片示例
sdl显示一张bmp图片示例
发布时间:2016-12-28 来源:查字典编辑
摘要:lesson01.cpp复制代码代码如下:/*ThissourcecodecopyrightedbyLazyFoo'Productions(...

lesson01.cpp

复制代码 代码如下:

/*This source code copyrighted by Lazy Foo' Productions (2004-2013)

and may not be redistributed without written permission.*/

//Include SDL functions and datatypes

#include "SDL/SDL.h"

int main( int argc, char* args[] )

{

//The images

SDL_Surface* hello = NULL;

SDL_Surface* screen = NULL;

//Start SDL

SDL_Init( SDL_INIT_EVERYTHING );

//Set up screen

screen = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE );

//Load image

hello = SDL_LoadBMP( "hello.bmp" );

//Apply image to screen

SDL_BlitSurface( hello, NULL, screen, NULL );

//Update Screen

SDL_Flip( screen );

//Pause

SDL_Delay( 2000 );

//Free the loaded image

SDL_FreeSurface( hello );

//Quit SDL

SDL_Quit();

return 0;

}

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新C语言学习
热门C语言学习
编程开发子分类