Guest User

Untitled

a guest
Nov 21st, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.23 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <iostream>
  3.  
  4. int main()
  5. {
  6.     // Declare and create a new render-window
  7.     sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
  8.  
  9.     // Limit the framerate to 60 frames per second (this step is optional)
  10.     window.setFramerateLimit(60);
  11.  
  12.  
  13.     // Load icon image
  14.     sf::Image icon;
  15.     if (icon.loadFromFile("icon.png"))
  16.     {
  17.         std::cout << "Success loading icon.png" << std::endl;
  18.     }
  19.  
  20.     // Set window icon
  21.     window.setIcon(256, 256, icon.getPixelsPtr());
  22.  
  23.     // The main loop - ends as soon as the window is closed
  24.     while (window.isOpen())
  25.     {
  26.         // Event processing
  27.         sf::Event event;
  28.         while (window.pollEvent(event))
  29.         {
  30.             // Request for closing the window
  31.             if (event.type == sf::Event::Closed)
  32.                 window.close();
  33.         }
  34.  
  35.         // Clear the whole window before rendering a new frame
  36.         window.clear();
  37.  
  38.         /*
  39.         // Draw some graphical entities
  40.         window.draw(sprite);
  41.         window.draw(circle);
  42.         window.draw(text);
  43.         */
  44.  
  45.         // End the current frame and display its contents on screen
  46.         window.display();
  47.     }
  48.  
  49.     return 0;
  50. }
Add Comment
Please, Sign In to add comment