hi, im creating a simple game here...its a shooting game...so how can I make my program read the keyboard to control the player's movement around?tnx in advance
I do not recall the arrow keys having a virtual key code associated with them from standard C++.
I think the only way to do it is through the OS interpretation of the virtual key code of the keyboard, though I could be wrong...
I think I understand what u mean.
I remember the old days when I was doing a simple "snake" game in pascal.
Back then I was able to do something like
.......move snake in one direction.....
..... process input key and change dirrection....
or something like it... The thing was that the snake was moving ( implemented in the loop ) and when an arrow key was pressed the direction would heve been changed. Ok, the only problem is that i don't know any standard C function that would do the samething thing as keypressed in pascal. The only alternative I can think about is having another thread that listens to user input, push the event in a global queue and have the "game running" thread process the event queue with user input. This is a more general approach, but I'm still wondering if C has any function like keypressed() :) . So if anybody can enlighten me... :)
Yes, you really are asking an OS and SDK-dependent question.
If you are using something like SDL, then respond to the key events that SDL gives you. Most GUI/graphics toolkits will give you a way to hook into keyboard events.
If you are using straight Win32, look for WM_KEYDOWN events in your message loop.
If you are using X, make sure you have selected an appropriate KeyPressMask and watch for KeyPress events in your main event loop.
If you are using something else, please let us know.
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...
Hello All ...
Iam Getting An Error With try to excecute the stored procedure .
I have Have Sql database , the stored procedure like so :
USE [MPRS] GO /****** Object: StoredProcedure [dbo].[Search_Licenses_By_Number] Script Date: 26-Nov-16 8:06:52 AM ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ALTER PROCEDURE ...
Help! I want to create a java program that finds the highest even integer among the values entered by the user. Stop asking values when a value less than 1 have been entered. If no even integer is entered, display "No Even Integer"
Here is the sample output that I ...