Thread: Arrows in Dev?

  1. #1

    Arrows in Dev?

    I am writing a RPG game as most of you will know. See my sig. IN it, you have to use letters or the numpad to navigate, and i think that making the arrow keys available to navigate would be helpful. Can anyone tell me how to do this in Dev? (which has no kbhit())? Thanks in advance!

    ~Inquirer
    Compilers:
    GCC on Red Hat 8.1 (Primary)
    GCC on Mac OS X 10.2.4 (Secondary)

    Others:
    MinGW on XP

  2. #2
    I haven't used console in Dev-C++ in so long I couldn't tell you. I found a way to do it, I just don't remember. I guess I'm just hooked to Allegro's keyboard handler.

  3. #3
    x4000 Ruski's Avatar
    Join Date
    Jun 2002
    Location
    Outer Space!
    Posts
    542
    Better move from Dev to VC++, it's much better
    what does signature stand for?

  4. #4
    Registered User JoshG's Avatar
    Join Date
    Mar 2002
    Posts
    326
    It is not too hard, just use getch or getc or whatever it is, and hit an arrow key and display what was inputed to the screen, do this for all the arrows. Then you know what the hex code for that key is, so you just use getc or getch and test to see if the input is that number. Umm, it makes sense to me, I would code an example, but I am tired.

  5. #5
    TechWins
    Guest
    Actually there is kbhit(); it's under the header of conio.c. But you can always use getch() anyways, so it's not that big of a deal. www.asciitable.com will be of some help to you probably.

  6. #6
    "The Oldest Member Here" Xterria's Avatar
    Join Date
    Sep 2001
    Location
    Buffalo, NY
    Posts
    1,039
    well, you know that you can use windows.h in a windows console, which is what dev makes.

    simple(GetAsyncKeyState):

    Code:
    #include <windows.h>
    //code code code.....
    if(GetAsyncKeyState(VK_RIGHT))
    {
         cout << "Pooopies";
    }
    VK_RIGHT == right arrow key
    VK_LEFT == left arrow key
    VK_DOWN == i think you get the point!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Resources with Dev C++ Problem (many simple problems)
    By Zeusbwr in forum Windows Programming
    Replies: 4
    Last Post: 04-06-2005, 11:08 PM
  2. New to Dev C++/<windows.h>...
    By Cilius in forum C++ Programming
    Replies: 3
    Last Post: 02-23-2005, 01:05 AM
  3. Glut and Dev C++, Programs not Quitting?
    By Zeusbwr in forum Game Programming
    Replies: 13
    Last Post: 11-29-2004, 08:43 PM
  4. openGL programming - From MSVC++ to Dev C++
    By WDT in forum Game Programming
    Replies: 3
    Last Post: 03-08-2004, 08:47 PM
  5. Tutorial about Bloodshed Dev!
    By Unregistered in forum C++ Programming
    Replies: 2
    Last Post: 11-13-2001, 07:42 PM