SFML community forums

Help => Window => Topic started by: Ajm113 on February 21, 2009, 11:34:07 pm

Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 21, 2009, 11:34:07 pm
Hello, SFML community!

Ok, I decided to get my game going on for Linux and Mac from Win32, but I needed a good API that was portable easy and this API looks about right! :wink:


Ok, I got a bool array of 256. What I want to do is so the ID number of a key was pressed like A was pressed row 1 of that array will be set to true and when A is released row 1 is set to false.

How can I do that? Like Wparam and Win32 examples show sometimes.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Laurent on February 22, 2009, 09:13:15 am
You don't need to do so, sf::Input already keeps track of the keys state.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 22, 2009, 04:15:45 pm
Alright, I'll play around with it. Its wired its like IntelliSense isn't picking up on your API that well. It seemed to work a while ago now it's Intellisense isn't showing a drop down box .

Any ways I have a couple more questions.

Whats a alternative of timeGetTime from windows in your API? I need it for my performance handler.

How can I set a window's state? I.E Maximize, Minimize, etc?

And how can I get the user's screen x,y cords?

Thank you, Andrew.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Laurent on February 22, 2009, 05:27:58 pm
Maybe you should just read the documentation and tutorials instead of relying on Intellisense? :wink:
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 22, 2009, 09:06:27 pm
Ok, I got most of what I want converted. How can I display a Messagebox? I looked through your docs. It seems you guys cover everything except that.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Laurent on February 22, 2009, 10:31:06 pm
There's currently nothing for message boxes in SFML.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 22, 2009, 11:03:56 pm
Really, why? You guys cover everything, except for a message box?? Can you suggest what to do?
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Laurent on February 22, 2009, 11:19:04 pm
Well, SFML is not a windowing API such as Qt or wxWidgets. All it has to do is providing a window to draw into. Message boxes are not directly related to what you can expect from SFML.

However, you can draw one inside your window using a rectangular shape and a graphical string :)
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 23, 2009, 12:05:58 am
Well whats Linux's Messagebox command?

I thought something like this feature would be no problem to add. If your API can run on different Operating Systems.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: dorkfish on February 23, 2009, 04:15:22 am
It might not be hard to implement, but it's outside of SFML's scope. SFML doesn't provide any GUI elements, and (probably) never will. If you want native message boxes, use a UI toolkit like GTK, QT, or wxWidgets. Like someone else said above, you could also write your own SFML-based message box, with a rectangle or string. Or you could take a look at the wiki, there's the starts of a GUI framework for SFML there. It's called IMGUI.
Title: Get Key ID When Key Is Pressed? (C++)
Post by: Ajm113 on February 23, 2009, 02:45:22 pm
Ok, I just converted everything and it compiles fine. Its just I get this problem:

(http://i40.tinypic.com/2qw20kz.jpg)

I mite go with GTK, I'll just finish what I have going on here and then see by the weekend on getting linux and then compiling the game on it.