I am new to win32 programing and I am trying to write a simple game in which there are fifteen rectangles on the screen and the user can take up to three away how can I make a keyboard imput of 1, 2 or 3 remove said amount of rectangles
As soon as I read this I think a half dozen ways popped into my head. First we need to know if you are using a console, WIN32 GUI Window or some other third party library. But also, for my own benefit, why aren't you using the mouse for input (ignore this question if you are writing for a console)?
From this link you will get source code for console snake game which may help you in your project.In this blog you also find source code of other game e.g quiz game in c ,math quiz game in windows form application,Maze game in windows form application,3D bounce game in openGL etc.
without using graphics making car race game is difficult because drawing car image is impossible.
In my earlier post I have given like for console snake game source code so you have to choose similar to this game.
Actually, you can make graphics for console games. Here is where I show my old age. Back in the days of Windows 3.1 and prior to that when we used DOS, there were computer graphics. Lesure Suit Larry in the Land of the Leaping Lounge Lizards was one of these such games that ran in DOS. it is unheard of now at days because Windows is much easier to use, but it is not impossible. As for writing a graphical game in console, it would mean that the console game would take over the whole monitor and the ALT+TAB would not allow you to switch back. Windows Xp and Windows 7 will still window it and just put it in Full Screen mode, in older windows you would lose the ability to switch back to windows while the game was running. A lot of differences here to touch on.
I would recommend thinking about putting it in a window instead of a console. Also I would learn about how images work in regards to painting them to a window and how to create sprites. Also read up on creating game engines because without a game engine, you can't create a game that has things moving in it on its own. A lot of stuff you can't really cover here. If you have specific questions about game writing, then post your code and tell us what you intend to do with it and we can tell you what you are really doing and how to fix up your code.
As for the original poster, I understand your question which I think was lost to some people. You have a game where you remove objects, in this case rectangles, until there are none left. Either you want to take the last one or you don't, not sure on the rules but I understand your game.
You need to use the WM_CHAR to determine what key was pressed. Remember that the number pad is different from the numbers above the letters because there is an OEM code that goes with it to tell the operating system which key was pressed. this is great for games that use the number pad for direction movement! Hope this helps you!