Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Lucy2020

Pages: [1]
1
General / Re: loadFromFile always returns false (SFML 2.5.1 64-bit)
« on: March 11, 2019, 02:19:46 pm »
Make sure you do it like this C:\\Users\\ and not C:/Users/

2
General / Re: sf::Event::TextEntered is repeating Key Events;
« on: March 05, 2019, 08:19:02 am »
Whoops silly me ,seems your right and all the inputs work fine now , thanks for the help both of you and ill keep in mind to use the code tags next time  :D

3
General / Re: sf::Event::TextEntered is repeating Key Events;
« on: March 05, 2019, 08:14:20 am »
Yes int main()
{
   sf::RenderWindow window(sf::VideoMode(500, 500), "Text_Editor");
   
   Editor editor;
   
   while (window.isOpen())
   {
      sf::Event event;

      while (window.pollEvent(event))
      {
         if (event.type == sf::Event::Closed)
            window.close();
      }


      window.setKeyRepeatEnabled(false);


      window.clear(sf::Color::White);
      window.draw(editor.text);
      editor.Input(event);
      window.display();
   }
return 0;
}

4
General / sf::Event::TextEntered is repeating Key Events;
« on: March 05, 2019, 07:37:07 am »
Hello all I would like to hopefully get some help with this problem.

Project : This is a personal project to write a simple text editor;

So whenever I press a Key(unicode assigned) it will repeat multiple times heres a list of what I tried and the code :

window.setKeyRepeatEnabled(false);

Used isKeyPressed for real time input vs KeyPressed but produced same output regardless;

// Unknown is caps lock but as of now it seems to not work due to unknown reasons
Tried to switch code to if(sf::Keyboard::keyPressed(Q) && sf::Keyboard::keyPressed(Unknown)){text.setString(input = input + "Q"); std::cout<<"random output" <<std::endl;} // produced no output with Unknown

I then was thinking to put a bool flag so you can't have repetition of characters 1 char away but then that would lead to issues when writing things like last names and etc.



Also this is running from the main loop so I just passed event as reference so thats not the problem;


 Here is the code , if anymore is needed I can provide
Quote
void Editor::Input(sf::Event& event) {


      //if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 113) { text.setString(input = input + "q"); } }
      if (sf::Keyboard::isKeyPressed) { if (event.text.unicode == 113) { text.setString(input = input + "q"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 119) { text.setString(input = input + "w"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 101) { text.setString(input = input + "e"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 114) { text.setString(input = input + "r"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 116) { text.setString(input = input + "t"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 121) { text.setString(input = input + "y"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 117) { text.setString(input = input + "u"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 105) { text.setString(input = input + "i"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 111) { text.setString(input = input + "o"); } }
      if (event.type == sf::Event::TextEntered) { if (event.text.unicode == 112) { text.setString(input = input + "p"); } }


   
   }




Pages: [1]
anything