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.


Topics - Heryon

Pages: [1]
1
Graphics / sf::Text displaying square
« on: June 21, 2017, 02:58:26 am »
Hi, I have this code:
Code: [Select]
void TextEditor::handleEvent(const sf::Event& p_event)
{
   if(p_event.type == sf::Event::KeyPressed && p_event.key.code == sf::Keyboard::Return)
      addLine();

   else if(p_event.type == sf::Event::TextEntered)
      write(p_event);
}

void TextEditor::addLine()
{
   sf::String s(m_text.getString())
   s += "\n";
   m_text.setString(s);
}

void TextEditor::write(const sf::Event& p_event)
{
   sf::String s(m_text.getString());

   if(p_event.key.code != sf::Keyboard::BackSpace && p_event.key.code != sf::Keyboard::Return)
      s += static_cast<char>(p_event.text.unicode);

   m_text.setString(s);
}

When I press Return with this code, the Text goes to the next line but also writes a square at the beginning of the line.
If I comment the conditions which calls write(), no square is printed.
So why am I getting this strange behaviour?

2
Graphics / Glsl::Vec2 from sf::Vector2f
« on: April 25, 2017, 09:09:42 pm »
Hi, I'm using shaders in my app, and as setParameter is deprecated, I must use setUniform, but I don't know how to convert a sf::Vector2f into a Glsl::Vec2.

3
Window / Key Repeat
« on: April 08, 2017, 01:16:12 pm »
Hi, I am checking when a key is pressed to set a bool to true, and when it is released to set it to false, and when this bool is tru, my character moves. But with key repeat set to false, it doesn't work, and with key repeat set to true, the character starts to move, stops a little time, and then moves again.
Is there anyway to have something smooth?

4
Graphics / Smooth texture
« on: February 12, 2017, 10:40:30 pm »
I wanted to know if I can combine smoothed texture (with setSmooth()) and antialiasing, or if it is useless.

5
Window / Fullscreen Style
« on: February 02, 2017, 09:21:24 pm »
Hi, I wanted to know : is
sf::Style::Fullscreen
a real fullscreen or a windowed fullscreen ? Because it lets the mouse get out of the window, but I thought it was only for windowed fullscreen.

6
Window / Fullscreen
« on: January 21, 2017, 03:34:23 pm »
Hello,
I know how to open a Window in Fullscreen with sf::Style::Fullscreen, but I now want to detect when the user clicks on the "fullscreen" button of a window and how to open a window in this state.

Pages: [1]