Advertisement
GieeF

VIRUS.EXE

Jan 2nd, 2020
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.59 KB | None | 0 0
  1. #ifdef __cplusplus
  2.     #include <cstdlib>
  3. #else
  4.     #include <stdlib.h>
  5. #endif
  6.  
  7. #include <iostream>
  8. #include <fstream>
  9. #include <SDL/SDL.h>
  10.  
  11. using namespace std;
  12.  
  13. string fileName;
  14. string entireFileName;
  15. int option;
  16.  
  17. void menu() {
  18.     cout << "Podaj nazwe pliku (bez rozszerzenia): ";
  19.     cin >> fileName;
  20.     entireFileName = fileName + ".bmp";
  21.     fstream fileExists;
  22.     fileExists.open(entireFileName.c_str());
  23.     if(!fileExists.is_open()) {
  24.         cout << "File does not exist!" << endl;
  25.         menu();
  26.     }
  27.  
  28.  
  29.     cout << endl;
  30. }
  31.  
  32. int main ( int argc, char** argv )
  33. {
  34.     menu();
  35.     // load an image
  36.     SDL_Surface* bmp = SDL_LoadBMP(entireFileName.c_str());
  37.  
  38.     // program main loop
  39.     bool done = false;
  40.     while (!done)
  41.     {
  42.         // message processing loop
  43.         SDL_Event event;
  44.         while (SDL_PollEvent(&event))
  45.         {
  46.             // check for messages
  47.             switch (event.type)
  48.             {
  49.                 // exit if the window is closed
  50.             case SDL_QUIT:
  51.                 done = true;
  52.                 break;
  53.  
  54.                 // check for keypresses
  55.             case SDL_KEYDOWN:
  56.                 {
  57.                     // exit if ESCAPE is pressed
  58.                     if (event.key.keysym.sym == SDLK_ESCAPE)
  59.                         done = true;
  60.                     break;
  61.                 }
  62.             } // end switch
  63.         } // end of message processing
  64.     } // end main loop
  65.  
  66.     // free loaded bitmap
  67.     SDL_FreeSurface(bmp);
  68.  
  69.     // all is well ;)
  70.     printf("Exited cleanly\n");
  71.     return 0;
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement