/*notice the default arguments for main. SDL expects main to look like that, so don't change it*/ int main(int argc, char *argv[]) { SDL_Surface *temp = NULL; int i; int done; int tx = 0,ty = 0; const Uint8 *keys; char imagepath[512]; SDL_Rect srcRect={0,0,800,600}; Init_All(); temp = IMG_Load("images/bgtest.png");/*notice that the path is part of the filename*/ //if(temp != NULL) //{ // for(i = 0;i < 12;i++) // { // drawSprite(tile,buffer,(i * tile->w) + tx,ty,0); // SDL_FreeSurface(temp); // } //} slog("got here"); gt_graphics_render_surface_to_screen(temp,srcRect,0,0); SDL_FreeSurface(temp); slog("got here"); done = 0; do { ResetBuffer(); NextFrame(); SDL_PumpEvents(); keys = SDL_GetKeyboardState(NULL); if(keys[SDL_SCANCODE_ESCAPE]) { done = 1; } }while(!done); slog("got here"); exit(0); /*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/ return 0; }
/*notice the default arguments for main. SDL expects main to look like that, so don't change it*/ int main(int argc, char *argv[]) { SDL_Surface *temp = NULL; int done; int tx = 0,ty = 0; const Uint8 *keys; char imagepath[512]; Sprite *sprite; SDL_Rect srcRect={0,0,800,600}; Init_All(); temp = IMG_Load("images/bgtest.png");/*notice that the path is part of the filename*/ if(temp != NULL) { printf("temp image loaded successfully\n"); SDL_BlitSurface(temp,NULL,buffer,NULL); } slog("got here"); gt_graphics_render_surface_to_screen(temp,srcRect,0,0); SDL_FreeSurface(temp); slog("got here"); done = 0; sprite = loadSprite("images/32_32_16_2sprite.png",32,32); do { ResetBuffer(); drawSprite(sprite,5,vec2d(20,20)); NextFrame(); SDL_PumpEvents(); keys = SDL_GetKeyboardState(NULL); if(keys[SDL_SCANCODE_ESCAPE]) { done = 1; } }while(!done); slog("got here"); exit(0); /*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/ return 0; }