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

Author Topic: Text box input?  (Read 4376 times)

0 Members and 1 Guest are viewing this topic.

MihaiAM

  • Newbie
  • *
  • Posts: 1
    • View Profile
Text box input?
« on: November 21, 2016, 11:02:23 pm »
Hi people! I'm new in sfml and new on this forum  ;D
I'm tryin' to realise a game in c++ using SFML ... right now I'm looking for a text box and I can't make . I found nowhere what to use . I just want to know how to make a text box input to login with a username and a password in order to play the game.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
Text box input?
« Reply #1 on: November 22, 2016, 01:43:13 am »
You can use simple rectangle shapes to draw the box and then use the sf::Event::TextEntered event to retrieve text input, add it to a string, use that string with a text object to render to the screen within the rectangle shape.

I suggest you try everything individually first and make sure to read the official tutorials, until you understand every class in use.

Also keep in mind that there are existing GUI libraries that can be used with SFML, e.g. SFGUI, TGUI, imgui, etc.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything