1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
|
SDL_Window *window;
SDL_Renderer *renderer;
SDL_Texture *firstPic;
SDL_Surface *AdamTmp;
SDL_Texture *Adam;
SDL_Rect srcRec,destRec;
SDL_Event event;
bool gameInit(){
if(SDL_Init(SDL_INIT_EVERYTHING) < 0){
cout << "error" << endl;
return false;
}
if(IMG_Init(IMG_INIT_PNG) < 0){
cout << "error" << endl;
return false;
}
window = SDL_CreateWindow("The GTG game",SDL_WINDOWPOS_CENTERED,SDL_WINDOWPOS_CENTERED,670,600,SDL_WINDOW_RESIZABLE);
renderer = SDL_CreateRenderer(window,-1,0);
AdamTmp = IMG_Load("M.png");
Adam = SDL_CreateTextureFromSurface(renderer,AdamTmp);
SDL_SetRenderDrawColor(renderer,255,255,255,255);
return true;
}
void render(){
SDL_RenderClear(renderer);
SDL_RenderCopy(renderer,Adam,NULL,&destRec);
SDL_RenderPresent(renderer);
}
|