Advertisement
Guest User

Untitled

a guest
Sep 14th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.     Demo 2 na podstawie projektu SQUARE:
  3.     https://github.com/sheadovas/SQUARE/blob/master/_Window.cpp
  4.     https://github.com/sheadovas/SQUARE/blob/master/_Window.h
  5. */
  6.  
  7. Text text;
  8. ... // <- ustawienie czcionki, pozycji, etc
  9.  
  10. String data = "";
  11. RenderWindow window(...);
  12.  
  13. while(window.isOpen())
  14. {
  15.     Event event;
  16.    
  17.     while(window.pollEvent(event)
  18.     {
  19.         if (event.type == Event::TextEntered)
  20.         {
  21.             if (event.text.unicode < 128)
  22.                 data += static_cast<char>(event.text.unicode);
  23.             text.setString(data);
  24.         }
  25.     }
  26.     ... // <- czyszczenie, rysowanie innych ewentualnych obiektów
  27.     window.draw(text); // rysowanie tekstu
  28.     ...
  29.     window.display();
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement