title: C SDL VS Code image is not displaying
body: <p>I have recently started learning game programming in C. I am using a virtual studio code on linux Ubuntu, and image star.png is not displaying on the screen, there are no errors or problems reported by vs code. I have tried reinstalling sdl2-dev and sdl2-image-dev libraries. Maybe it is a problem with SDL, or maybe with my code (it was written in 2013).</p>
  
  <p>The code should draw a white ractangl, which i can move around, on a blue screen and place a star in upper left corner of a window. It does everything except placing a star.</p>
  
  <p>The code: (doesn't show "Cannot dinf star.png!" so I guess it is not that)</p>
  
  <pre><code>#include &lt;SDL2/SDL.h&gt; 
  #include &lt;SDL2/SDL_image.h&gt;
  #include &lt;stdio.h&gt;
  
  typedef struct 
  {
      int x, y;
      short life;
      char *name;
  }Man;
  
  typedef struct          
  {
      //players
      Man man;
  
      //image
      SDL_Texture *star;
  } GameState;
  
  
  /////////////////////////////////////////////////////////////////////processEvents
  int processEvents(SDL_Window *window , GameState *game)        
  {
  
      SDL_Event event;
      int done = 0;
          //Check for events
  
          while (SDL_PollEvent(&amp;event))       
          {
              switch (event.type)             
              {
              case SDL_WINDOWEVENT_CLOSE:     
              {
                  if (window)
                  {
                      SDL_DestroyWindow(window);
                      window = NULL;
                      done = 1;
                  }
              }   
                  break;
              case SDL_KEYDOWN:       
              {
                  switch (event.key.keysym.sym)
                  {
                  case SDLK_ESCAPE:
                      done = 1;
                  break;
  
                  }
              }
              break;          
              case SDL_QUIT:     
              done = 1;
              break;
              }
          }
  
      const Uint8 *state = SDL_GetKeyboardState(NULL);    
      if(state[SDL_SCANCODE_LEFT])
      {
          game-&gt;man.x -= 1;
      }
      if(state[SDL_SCANCODE_RIGHT])
      {
          game-&gt;man.x += 1;
      }
      if(state[SDL_SCANCODE_UP])
      {
          game-&gt;man.y -= 1;
      }
      if(state[SDL_SCANCODE_DOWN])
      {
          game-&gt;man.y += 1;
      }
      SDL_Delay(10);
      return done;
  
  }
  
  /////////////////////////////////////////////////////////////////////////////////////doRender
  void doRedner(SDL_Renderer *renderer, GameState *game)      
  {
  
          SDL_SetRenderDrawColor(renderer , 0, 0, 255, 255); //blue
  
          //screen clean up into blue
          SDL_RenderClear(renderer);
  
          //set color
          SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
  
          SDL_Rect rect = {game-&gt;man.x, game-&gt;man.y, 80, 80};       
          SDL_RenderFillRect(renderer, &amp;rect);        
  
          //draw a star
          SDL_Rect starRect = { 50, 50, 64, 64 };                  
          SDL_RenderCopy(renderer, game-&gt;star, NULL, &amp;starRect);      
  
          SDL_RenderPresent(renderer);
  
  }
  
  /////////////////////////////////////////////////////////////////////////////////////main funkction
  
  int main(int argc, char *argv[])
  {
      GameState gameState;
      SDL_Window *window = NULL;            
      SDL_Renderer *renderer = NULL;   
      SDL_Surface *starSurface = NULL;       
  
      SDL_Init(SDL_INIT_VIDEO);       
  
      gameState.man.x = 340-40;
      gameState.man.y = 240-40; 
  
      window = SDL_CreateWindow("Game Widnow",            
      SDL_WINDOWPOS_UNDEFINED,                            
      SDL_WINDOWPOS_UNDEFINED,                            
      640,                                                
      480,                                                
      0                                                   
      );
  renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC);       
  
  //load image
  starSurface = IMG_Load("star.png");
  if(starSurface = NULL)
  {
      printf("Cannot find star.png!\n\n");
      SDL_Quit();
      return 1;
  }
  
  gameState.star = SDL_CreateTextureFromSurface(renderer, starSurface);       
  SDL_FreeSurface(starSurface);                                              
  
  int done = 0;   
      while(!done)        
      {
          //check events
          done = processEvents(window, &amp;gameState);    
  
          //render
          doRedner(renderer, &amp;gameState);
  
  
      }
  
      SDL_Delay(1000);
  
      //exit game and free memory
      SDL_DestroyTexture(gameState.star);
  
      //destroy and close window
      SDL_DestroyWindow(window);
      SDL_DestroyRenderer(renderer);
  
      SDL_Quit();
  
  return 0;
  }
  </code></pre>