Guest User

Untitled

a guest
May 7th, 2020
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.28 KB | None | 0 0
  1. //////////////////// h file
  2. class Phonk
  3. {
  4.     bool isNothing = true;
  5.     bool isHovered = false;
  6.     sf::Text text;
  7.     sf::Font font;
  8. public:
  9.     Phonk();
  10.     void setText(sf::Vector2f pos, std::string value,int size);
  11.     bool clicked(sf::Vector2f cursor, bool isClick);
  12.     sf::Text getText() { return text; };
  13. };
  14.  
  15. class UI
  16. {
  17. private:
  18. std::vector<Phonk> settings;
  19. public:
  20. UI(double)
  21. sf::Text getTextFromSettings();
  22. };
  23. ///////////////////////// cpp file
  24. UI::UI(double health)
  25. {
  26.     for (int i = 0; i < 1; i++)
  27.     {
  28.         settings.push_back(Phonk());
  29.     }
  30.     settings[0].setText(sf::Vector2f(-1000, -500), "set screen size for anal sex", 150);
  31. }
  32. void Phonk::setText(sf::Vector2f pos, std::string value,int size)
  33. {
  34.     text.setString(value);
  35.     text.setCharacterSize(size);
  36.     text.setPosition(pos);
  37.     text.setOrigin((text.getGlobalBounds().width + text.getGlobalBounds().left - text.getGlobalBounds().left) / 2, (text.getGlobalBounds().height + text.getGlobalBounds().top - text.getGlobalBounds().top) / 2);
  38. }
  39.  
  40. Text UI::getTextFromSettings()
  41. {
  42.     return settings[0].getText();
  43. }
  44. /////// main file
  45. window.draw(user_interface.getTextFromSettings());
  46. /////////////error: Exception thrown at 0x00007FFD5EA639E3 (sfml-graphics-2.dll) in NoPasaran.exe: 0xC0000005: Access violation reading location 0x000000070000000E.
Advertisement
Add Comment
Please, Sign In to add comment