level 8
取这个名字真难
楼主
#include "SDL/SDL.h"
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
int main(int args,char *argv[])
{
SDL_Surface *p,*l=NULL,*b;
TTF_Font *f=NULL;
SDL_Color c={255,255,255};
TTF_Init();
SDL_Init(SDL_INIT_EVERYTHING);
b=SDL_SetVideoMode(640,320,32,SDL_SWSURFACE);
p=IMG_Load("1.png");
f = TTF_OpenFont( "lazy.ttf", 28 );
l = TTF_RenderText_Solid( f, "The quick brown fox jumps over the lazy dog", c);
SDL_BlitSurface(p,NULL,b,NULL);
SDL_BlitSurface(l,NULL,b,NULL);
SDL_Flip(b);
SDL_Delay(2000);
return 0;
}
我检查出来是l = TTF_RenderText_Solid( f, "The quick brown fox jumps over the lazy dog", c);这句出了问题,可是这句是我按教程写的,而教程的源码运行正常,
求教是哪里错了。
2016年11月20日 06点11分
1
#include "SDL/SDL_image.h"
#include "SDL/SDL_ttf.h"
int main(int args,char *argv[])
{
SDL_Surface *p,*l=NULL,*b;
TTF_Font *f=NULL;
SDL_Color c={255,255,255};
TTF_Init();
SDL_Init(SDL_INIT_EVERYTHING);
b=SDL_SetVideoMode(640,320,32,SDL_SWSURFACE);
p=IMG_Load("1.png");
f = TTF_OpenFont( "lazy.ttf", 28 );
l = TTF_RenderText_Solid( f, "The quick brown fox jumps over the lazy dog", c);
SDL_BlitSurface(p,NULL,b,NULL);
SDL_BlitSurface(l,NULL,b,NULL);
SDL_Flip(b);
SDL_Delay(2000);
return 0;
}
我检查出来是l = TTF_RenderText_Solid( f, "The quick brown fox jumps over the lazy dog", c);这句出了问题,可是这句是我按教程写的,而教程的源码运行正常,
求教是哪里错了。