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

Author Topic: Portugues Keyboard - Support  (Read 3305 times)

0 Members and 1 Guest are viewing this topic.

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Portugues Keyboard - Support
« on: December 11, 2008, 07:34:08 pm »
How to support portuguese keyboard?

Some key are different of default of sfml.

How support it? Keys like it (ç/Ç/¨/ã/á/....)

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Portugues Keyboard - Support
« Reply #1 on: December 12, 2008, 07:59:12 am »
If you're talking about text input, then just use sf::Event::TextEntered which delivers Unicode and not sf::Event::KeyPressed.

If you really need these keys for the key press event, then I'm sorry I have no solution yet. But it's planned, probably for the 1.5 version.
Laurent Gomila - SFML developer

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Portugues Keyboard - Support
« Reply #2 on: December 12, 2008, 09:39:46 am »
I have tested the project called "IMGUI" (http://www.sfml-dev.org/wiki/en/projects) and i compile here and it support this letters and others too...

But on my project, the letters are some blank spaces...

Im read all the code and i get unicode char with the same method, but i dont know what happen...

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Portugues Keyboard - Support
« Reply #3 on: December 12, 2008, 09:50:37 am »
Hi,

I solve the problem.

I dont know wy, but when you have your text in WSTRING and put on sf::String the unicode is lost.

So i convert the WSTRING atributes of my classes to STRING and it function normals, accepting all portuguese letters.

Ty.

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
Portugues Keyboard - Support
« Reply #4 on: December 12, 2008, 11:00:34 am »
You should show us the relevant parts of your code, it's hard to help you with so few details.
Laurent Gomila - SFML developer

prchakal

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Portugues Keyboard - Support
« Reply #5 on: December 12, 2008, 11:46:50 am »
Dont need more, i have solved.

But u can try it:

Code: [Select]


wstring test;
test = L"coração";  //  <-error

sf::String textBox;
sf::Font font;

if (!font.LoadFromFile("dados\\fontes\\tahoma.ttf"))
{
     //failed
}

textBox.SetText(test);
textBox.SetSize(12);
textBox.SetFont(font);



Conclusion, you can put in WSTRING some portuguese letters, or if you force with cast, occur the same problem.

Solution: use only STRING on SetText.

 

anything