#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Posts
    18
    Rep Power
    0

    how to capture user input?


    i m using visual c++ incorporate with direct X write this code....

    sir, instead of writing that for prompt user imput...........do u have any good idea? which can use loop? i try it.but cannot.so,i use if statement only...............

    if (KEYPRESSED('A')){ SourceIndex = 0; Sleep(50);}
    if (KEYPRESSED('B')){ SourceIndex = 1; Sleep(50);}
    if (KEYPRESSED('C')){ SourceIndex = 2; Sleep(50);}
    if (KEYPRESSED('D')){ SourceIndex = 3; Sleep(50);}
    if (KEYPRESSED('E')){ SourceIndex = 4; Sleep(50);}
    if (KEYPRESSED('F')){ SourceIndex = 5; Sleep(50);}
    if (KEYPRESSED('G')){ SourceIndex = 6; Sleep(50);}
    if (KEYPRESSED('H')){ SourceIndex = 7; Sleep(50);}
    if (KEYPRESSED('I')){ SourceIndex = 8; Sleep(50);}
    if (KEYPRESSED('J')){ SourceIndex = 9; Sleep(50);}
    if (KEYPRESSED('K')){ SourceIndex = 11; Sleep(50);}
    if (KEYPRESSED('L')){ SourceIndex = 12; Sleep(50);}


    if (KEYPRESSED('M')){ DestinationIndex = 0; Sleep(50);}
    if (KEYPRESSED('N')){ DestinationIndex = 1; Sleep(50);}
    if (KEYPRESSED('O')){ DestinationIndex = 2; Sleep(50);}
    if (KEYPRESSED('P')){ DestinationIndex = 3; Sleep(50);}
    if (KEYPRESSED('Q')){ DestinationIndex = 4; Sleep(50);}
    if (KEYPRESSED('R')){ DestinationIndex = 5; Sleep(50);}
    if (KEYPRESSED('S')){ DestinationIndex = 6; Sleep(50);}
    if (KEYPRESSED('T')){ DestinationIndex = 7; Sleep(50);}
    if (KEYPRESSED('U')){ DestinationIndex = 8; Sleep(50);}
    if (KEYPRESSED('V')){ DestinationIndex = 9; Sleep(50);}
    if (KEYPRESSED('W')){ DestinationIndex = 11; Sleep(50);}
    if (KEYPRESSED('X')){ DestinationIndex = 12; Sleep(50);}

    do u have better way instead of this way capture user input??
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Location
    Representin' Quebec
    Posts
    106
    Rep Power
    12
    I don't use DirectX so this might not work... but try to use a 'switch'. Like this sorta:

    switch(KEYPRESSED()) {
    case A:
    case M:
    SourceIndex = 0;
    Sleep(50);
    break;
    case B:
    case N:
    SourceIndex = 1;
    Sleep(50);
    break;
    }

    And so on.... That might not be the exact code though.

IMN logo majestic logo threadwatch logo seochat tools logo