Advertisement
Guest User

TGUI Chatbox Problem

a guest
Jan 22nd, 2014
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. #include <SFML/Graphics.hpp>
  4.  
  5. #include <TGUI/TGUI.hpp>
  6.  
  7. int main()
  8. {
  9.     sf::RenderWindow window(sf::VideoMode(800, 450), "TGUI");
  10.     window.setVerticalSyncEnabled(true);
  11.  
  12.     tgui::Gui gui(window);
  13.  
  14.     gui.setGlobalFont("visitor1.ttf");
  15.    
  16.     tgui::ChatBox::Ptr chatbox(gui);
  17.     chatbox->load("data/tgui/widgets/White.conf");
  18.     chatbox->setPosition({ 100.f, 100.f });
  19.     chatbox->setSize(300.f, 300.f);
  20.     chatbox->addLine("Test", sf::Color::Black);
  21.     chatbox->addLine("Test2", sf::Color::Black);
  22.     chatbox->addLine("ASFASF", sf::Color::Black);
  23.  
  24.     gui.saveWidgetsToFile("test.txt");
  25.  
  26.     while (window.isOpen())
  27.     {
  28.         sf::Event event;
  29.         while (window.pollEvent(event))
  30.         {
  31.             if (event.type == sf::Event::Closed)
  32.                 window.close();
  33.  
  34.             gui.handleEvent(event);
  35.         }
  36.  
  37.         tgui::Callback callback;
  38.         while (gui.pollCallback(callback))
  39.         {
  40.            
  41.         }
  42.  
  43.         window.clear();
  44.         gui.draw();
  45.         window.display();
  46.     }
  47.  
  48.  
  49.     return 0;
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement