Advertisement
Guest User

Untitled

a guest
Nov 18th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.08 KB | None | 0 0
  1. #include <SFML/Graphics.hpp>
  2. #include <SFML/OpenGL.hpp>
  3. #include <windows.h>
  4. #include <iostream>
  5.  
  6. int main()
  7. {
  8.     // create the window
  9.     sf::RenderWindow window(sf::VideoMode(800, 600), "OpenGL", sf::Style::Default, sf::ContextSettings(32));
  10.     //window.setVerticalSyncEnabled(true);
  11.  
  12.     // load resources, initialize the OpenGL states, ...
  13.     sf::Text _label;
  14.     _label.setString("Test");
  15.     _label.setCharacterSize(20);
  16.     _label.setColor(sf::Color(255, 0, 0, 255));
  17.     //_label.setVisible(true);
  18.     sf::Font fnt;
  19.     if(!fnt.loadFromFile("MankSans.ttf"))
  20.         printf("Could not load font!\n");
  21.     _label.setFont(fnt);
  22.  
  23.  
  24.     // run the main loop
  25.     bool running = true;
  26.     while (running)
  27.     {
  28.         // handle events
  29.         sf::Event event;
  30.         while (window.pollEvent(event))
  31.         {
  32.             if (event.type == sf::Event::Closed)
  33.             {
  34.                 // end the program
  35.                 running = false;
  36.             }
  37.         }
  38.  
  39.         // clear the buffers
  40.         window.clear();
  41.  
  42.         printf("Draw\n");
  43.         window.draw(_label);
  44.  
  45.         // end the current frame (internally swaps the front and back buffers)
  46.         window.display();
  47.     }
  48.  
  49.     // release resources...
  50.  
  51.     return 0;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement