qiebixuefu2013
陶子11
2015-11-01 10:22
采纳率: 33.3%
浏览 572

eclipse下用sdl2加载图片

最近老师让用sdl2实现时钟,我在ubuntu下用eclipse写代码,编译得时候没有问题,
就是运行得时候什么都没有,对sdl不了解,想问问是怎么回事。
#include "SDL2/SDL.h"

int main( int argc, char* args[] )
{
SDL_Window* Window = NULL;
SDL_Surface* hello = NULL;

SDL_Init( SDL_INIT_EVERYTHING );

Window = SDL_CreateWindow("SDL_Window", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 240, 400, SDL_WINDOW_SHOWN);

//Load image


hello = SDL_GetWindowSurface(Window);
hello = SDL_LoadBMP( "/home/×××××/lesson01/hello.bmp" );
SDL_FreeSurface(hello);

SDL_DestroyWindow(Window);

SDL_Quit();

return 0;

}

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

相关推荐