C语言 SDL问题
#include"SDL/SDL.h"#include<string>constintSCREEN_WIDTH=640;constintSCREEN_HEIGHT=480...
#include "SDL/SDL.h"#include <string>const int SCREEN_WIDTH = 640;const int SCREEN_HEIGHT = 480;const int SCREEN_BPP= 64;SDL_Surface *message = NULL;SDL_Surface *background = NULL;SDL_Surface *screen = NULL;SDL_Surface *load_image(std::string filename){ //tempory storage for the image that's loaded SDL_Surface* loadedImage = NULL; SDL_Surface* optimizedImage = NULL; // LTI loadedImage = SDL_LoadBMP(filename.c_str()); if(loadedImage != NULL) { optimizedImage = SDL_DisplayFormat(loadedImage); SDL_FreeSurface(loadedImage); } return optimizedImage; // free old}void apply_surface(int x,int y,SDL_Surface* source,SDL_Surface* destination){ SDL_Rect offset; offset.x = x; offset.y =y; SDL_BlitSurface(source,NULL,destination,&offset);}int main(int argc,char* args[]){ //initgra if(SDL_Init(SDL_INIT_EVERYTHING) == -1) { return -1; } screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,SCREEN_BPP,SDL_SWSURFACE); if(screen == NULL) { return 1; } SDL_WM_SetCaption("Hello World",NULL); message = load_image("hello.bmp"); background = load_image("background.bmp"); apply_surface(0,0,background,screen); }这个是代码 环境都配置好了 不要跟我说什么环境问题 SDL2.dll都有了 我在command link编译的 。
展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询