sdl显示bmp图片 sdl显示一张bmp图片示例

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

sdl显示bmp图片 sdl显示一张bmp图片示例

  2021-03-19 我要评论
想了解sdl显示一张bmp图片示例的相关内容吗,在本文为您仔细讲解sdl显示bmp图片的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:sdl,bmp图片,下面大家一起来学习吧。

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;
}

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们