Advertisement
Guest User

Untitled

a guest
Sep 20th, 2014
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "SDL.h"
  2.  
  3. int main()
  4. {
  5.     SDL_Init(SDL_INIT_EVERYTHING);
  6.    
  7.     SDL_Window* window = SDL_CreateWindow();
  8.     SDL_Texture* player = IMG_LoadTexture("Player.png");
  9.     int x, y = 0;
  10.    
  11.     bool run = true;
  12.     while (run)
  13.     {
  14.         SDL_Event* e;
  15.         while (SDL_PollEvent(e))
  16.         {
  17.             if (e->type == SDL_QUIT)
  18.             {
  19.                 run = false;
  20.             }
  21.             if (e->type == SDL_MOUSEBUTTONDOWN)
  22.             {
  23.                 x = e->pos.x;
  24.                 y = e->pos.y;
  25.             }
  26.         }
  27.         SDL_RenderTexture(player, x, y);
  28.     }
  29.     SDL_Quit();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement