Im planning a little programming project to try to improve my programming skills but I have ran into a little problem. I got inspired when I watched 3D buzz video tutorial when they made a console based game. I thought that this could be something I could try to do as a personal spare time project. I came to the conclusion that I wanted to try to not use windows.h. I wanted it to be portable to Linux/UNIX too. I found the pdcurses and ncurses library. So I got the tools I need to print on the console screen as I want. I know consoles arenīt optimal for this kind of thing. But thatīs a part of the challenge as it can be done.
But now I have ran into a problem I havenīt been able to solve. I need to be able to read the state of two or more keyboard keys at the same time.
Normally when I use pdcurses I get the input of a single key and then compare to see which key that was pressed. (Pretty much as the example at this page)
But I feel that this wont work if two players using the same keyboard are holding down two keys at once. Only the key that got pressed first will be read. So the other player wont be doing anything. And having the players pressing their keys rapidly doesnīt feel like an optimal solution.
Wait until a key is pressed
Check which key it was
Do something depending on which that was pressed.
I know that SDL got a way to read the state for a key. This would make me able to just make a few if and see if that key is hold down. Move in this direction and that for both the players. But including the whole SDL library for just this doesnīt seem optimal either.
I found wxWidget got a similar function too. I would only need to include the event library to use this. But I think the best solution would be if this could be done with pdcurses and ncurses only. I have tried to research for this but I come up with nothing.
So my question is if there is a better way to solve this? Have I missed something in the pdcurses or ncurses library? Or are there something that I can use to get this functionality?
Short facts: Pdcurses is a windows, dos port of ncurses which is a library to make text user interfaces. Wikipedia page
I hope I have provided enough information. If you need to know more. Please replay and I will do my best to provide more. Please also tell me if Im describing something in a weird way that you have trouble understanding. English isnīt my native language so sometimes I build my sentences little weird so they become confusing.