Key imput without getch()
Hi
I am writing a 2D game that only uses the arrow keys for input. I have done a search on this site fro ways to get input from the arrow keys and have come up with many solutions. However all of them use the getch() function. Normally this would be OK but for this project one of the files that I have to include raises 4 errors and a warning when I include (the header for getch()). The file that doesn't like getch() is DarkGDK, which I downloaded from www.msdn.com for its ease of use when creating games.
I was wondering if there are any alternatives.
I am using Visual C++ 2008 Express running on Windows XP.
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6
??????????? What do you mean?
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6
Probably the best place for Dark GDK question is Dark GDK community forum...
I can't imagine what's a relation between #include <conio.h> in your modules and errors in Dark GDK files...
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
All I want to know is how to do what getch() does without using getch().
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6
The Errors it gives me are:
libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
Main.obj : error LNK2019: unresolved external symbol _wgetch referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
Main.obj : error LNK2019: unresolved external symbol _keypad referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
Main.obj : error LNK2001: unresolved external symbol __imp__stdscr
Main.obj : error LNK2019: unresolved external symbol _noecho referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
Main.obj : error LNK2019: unresolved external symbol _cbreak referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
Main.obj : error LNK2019: unresolved external symbol _initscr referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __malloc_dbg referenced in function "void * __cdecl operator new(unsigned int,struct std::_DebugHeapTag_t const &,char *,int)" (??2@YAPAXIABU_DebugHeapTag_t@std@@PADH@Z)
libcpmtd.lib(xdebug.obj) : error LNK2019: unresolved external symbol __free_dbg referenced in function "void __cdecl operator delete(void *,struct std::_DebugHeapTag_t const &,char *,int)" (??3@YAXPAXABU_DebugHeapTag_t@std@@PADH@Z)
Debug\Snake.exe : fatal error LNK1120: 8 unresolved externals
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6
As far as I know Dark GDK application HAS NO CONSOLE at all. If so you can't use conio.h or Windows API ReadConsole stuff. It's GUI application. Dark GDK has its own keyboard event handling and corresponding API. You can find more info in DarkGDK docs or ask Dark GDK guru on Dark GDK forum.
May be I'm wrong?..
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
I found what I was looking for on the DarkGDK forum but does anyone know where to view a map of the keyboard with the numbers that correspond to the keys (ex: 71=num pad '8')?
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6
I found what I was looking for on the DarkGDK forum but does anyone know where to view a map of the keyboard with the numbers that correspond to the keys (ex: 71=num pad '8')?
Have you ever heard about Google search? ;) http://www.barcodeman.com/altek/mule/scandoc.php
ArkM
Postaholic
2,001 posts since Jul 2008
Reputation Points: 1,234
Solved Threads: 348
Sorry, No luck. The arrow keys still didn't respond.
waldchr
Junior Poster in Training
90 posts since Jun 2008
Reputation Points: 8
Solved Threads: 6