Keyboard not responding

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

Keyboard not responding

Postby Auradrummer » Thu Jul 31, 2008 10:21 am

Hello guys (nice forum skin!!!)

I'm stuck in reading keyboard. I made a very simple code, but it doesn't works. There is something else I need to do to read keyboard state?

take a look. I think anyone can understand it.

Code: Select all
#include <OpenGlUtil.h>
#include <stdio.h>

int main()
{
int count = 1;
int print = 0;

while (count != 0)
   {
      if (dGetKeyState (KeyCode_w))
         print = 1;

      if (dGetKeyState (KeyCode_s))
         print = 2;

      if (dGetKeyState (KeyCode_ESCAPE))
         count = 0;

      printf("%u \n", print);
   }
}


Is clear what it do: prints an line of zeros. When I press 'w' draw a line of ones, pressing 's' draws a line of two and exits when I press 'ESC'. But nothing is happening when I press those keys...

Any idea?
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Keyboard not responding

Postby Auradrummer » Thu Jul 31, 2008 12:41 pm

Someone? I really don't know what to do ...
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am

Re: Keyboard not responding

Postby Julio Jerez » Thu Jul 31, 2008 1:03 pm

why do yo uwant to use that keyboard code?
the funtion is different for each platform.
for window it si just a wraped ove the getasyncKey,
but I would not know why it do not work.
Julio Jerez
Moderator
Moderator
 
Posts: 11147
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: Keyboard not responding

Postby Auradrummer » Thu Jul 31, 2008 1:17 pm

I want to control an object by using keyboard, but I'm failing reading the keyboard.
Developing a racing game.
Auradrummer
 
Posts: 132
Joined: Sat May 17, 2008 9:17 am


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 3 guests