Hello,

I've been trying to get into game programming. So I learnt a simple 2d api, Direct2D because it has great documentation on msdn and started planning/programming my first game: a tetris clone.

All went well, and I also added sound and such, but now I want to add a high score table.
For that, the player needs to fill in his/her name. Now how do I do that?

The only text input i've known was the cin of console programs.
I want to make a input form like in html the <input type="text" />

So how do I do this? does winapi have some built in functionality to do this and how do most games do this? Do they perhaps create their own way for input?

Could you give me some clues? (doesn't have to be source code at all)

Thanks in advance,
Tigran

Hi, I'm not sure if you've solved this problem or not but getting keyboard input in a Windows Forms application is very straightforward, the event handlers are right there on the form itself. Maybe you can give some more detail about which part exactly you're finding difficult? What I do in my own games is use DirectInput so I strongly suggest checking out the samples for that API, it makes it easier to differentiate between immediate (controlling the player) input and buffered (entering your name) input. Hope this helps!

Thanks for your answer, but I already fixed it (should've posted the soluction, but forgot)
I used a TCHAR buffer with an int as caret position and added a letter every time I got a WM_CHAR message.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.