Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SFML/Graphics.hpp>
- #include <iostream>
- int main()
- {
- // Declare and create a new render-window
- sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");
- // Limit the framerate to 60 frames per second (this step is optional)
- window.setFramerateLimit(60);
- // Load icon image
- sf::Image icon;
- if (icon.loadFromFile("icon.png"))
- {
- std::cout << "Success loading icon.png" << std::endl;
- }
- // Set window icon
- window.setIcon(256, 256, icon.getPixelsPtr());
- // The main loop - ends as soon as the window is closed
- while (window.isOpen())
- {
- // Event processing
- sf::Event event;
- while (window.pollEvent(event))
- {
- // Request for closing the window
- if (event.type == sf::Event::Closed)
- window.close();
- }
- // Clear the whole window before rendering a new frame
- window.clear();
- /*
- // Draw some graphical entities
- window.draw(sprite);
- window.draw(circle);
- window.draw(text);
- */
- // End the current frame and display its contents on screen
- window.display();
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment