943,514 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 3397
  • C++ RSS
You are currently viewing page 1 of this multi-page discussion thread
Nov 22nd, 2008
0

Key imput without getch()

Expand Post »
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 <conio.h> (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.
Reputation Points: 8
Solved Threads: 6
Junior Poster in Training
waldchr is offline Offline
90 posts
since Jun 2008
Nov 22nd, 2008
0

Re: Key imput without getch()

Use getch() inside a thread..
Reputation Points: 47
Solved Threads: 69
Posting Whiz
cikara21 is offline Offline
340 posts
since Jul 2008
Nov 22nd, 2008
0

Re: Key imput without getch()

??????????? What do you mean?
Reputation Points: 8
Solved Threads: 6
Junior Poster in Training
waldchr is offline Offline
90 posts
since Jun 2008
Nov 22nd, 2008
0

Re: Key imput without getch()

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...
Last edited by ArkM; Nov 22nd, 2008 at 1:24 pm.
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 23rd, 2008
0

Re: Key imput without getch()

All I want to know is how to do what getch() does without using getch().
Reputation Points: 8
Solved Threads: 6
Junior Poster in Training
waldchr is offline Offline
90 posts
since Jun 2008
Nov 23rd, 2008
0

Re: Key imput without getch()

The Errors it gives me are:

C++ Syntax (Toggle Plain Text)
  1. libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
  2.  
  3. Main.obj : error LNK2019: unresolved external symbol _wgetch referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
  4.  
  5. Main.obj : error LNK2019: unresolved external symbol _keypad referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
  6.  
  7. Main.obj : error LNK2001: unresolved external symbol __imp__stdscr
  8.  
  9. Main.obj : error LNK2019: unresolved external symbol _noecho referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
  10.  
  11. Main.obj : error LNK2019: unresolved external symbol _cbreak referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
  12.  
  13. Main.obj : error LNK2019: unresolved external symbol _initscr referenced in function "void __cdecl DarkGDK(void)" (?DarkGDK@@YAXXZ)
  14.  
  15. 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)
  16.  
  17. 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)
  18.  
  19. Debug\Snake.exe : fatal error LNK1120: 8 unresolved externals
Reputation Points: 8
Solved Threads: 6
Junior Poster in Training
waldchr is offline Offline
90 posts
since Jun 2008
Nov 23rd, 2008
0

Re: Key imput without getch()

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?..
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008
Nov 23rd, 2008
0

Re: Key imput without getch()

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')?
Reputation Points: 8
Solved Threads: 6
Junior Poster in Training
waldchr is offline Offline
90 posts
since Jun 2008
Nov 23rd, 2008
0

Re: Key imput without getch()

I believe what you're looking for would be the ASCII character codes.
Reputation Points: 104
Solved Threads: 27
Posting Whiz in Training
dmanw100 is offline Offline
239 posts
since Apr 2008
Nov 24th, 2008
0

Re: Key imput without getch()

Click to Expand / Collapse  Quote originally posted by waldchr ...
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
Reputation Points: 1234
Solved Threads: 347
Postaholic
ArkM is offline Offline
2,001 posts
since Jul 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Removing picture from picturebox
Next Thread in C++ Forum Timeline: Need help with Histogram





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC