Hey it's novaman,
I Practice programming by developing games. I am trying to develop a dos based Black Jack game.
Though it is only in dos I am trying to give it a good look and feel.
I would like to know how to input keyboard key depressions without stopping the flow of the program.
This input is required on line 55 as indicated in the code.
This is just the skeleton, I need this solution to continue development.
CODE
public class OpenScreen
{
byte LoopStop1 = 0;
byte keypress1 = 0;
public OpenScreen( )
{
System.out.println( " ****************" );
System.out.println( " *** WELCOME TO ***" );
System.out.println( " ****************\n" );
///////////////////// Clock Stop///////////////////
try
{
Thread.sleep(1000);
}
catch (InterruptedException ex)
{
}
///////////////////////////////////////////////////
System.out.println( "A-K-Q-J-10-9-8-7-6-5-4-3-2-A-K-Q-J-10-9-8-7-6-5-4-3-2");
System.out.println( "A-K-Q-J-10-9-**************************-8-7-6-5-4-3-2");
System.out.println( "A-K-Q-J-10-9-********BLACK JACK********-8-7-6-5-4-3-2");
System.out.println( "A-K-Q-J-10-9-**************************-8-7-6-5-4-3-2");
System.out.println( "A-K-Q-J-10-9-8-7-6-5-4-3-2-A-K-Q-J-10-9-8-7-6-5-4-3-2");
System.out.printf( "\n\n\n\n\n\n\n\n\n\n\n\n\n" );
///////////////////// Clock Stop///////////////////
try
{
Thread.sleep(1000);
}
catch (InterruptedException ex)
{
}
///////////////////////////////////////////////////
///////////////////// Clear I/O ///////////////////
int i = 0;
while ( i < 1000 )
{
System.out.println( " " );
++i;
}
///////////////////////////////////////////////////
while ( LoopStop1 == 0 )
{
/* *** This is where I need to be able to imput key presses without
disrupting the flow of the program. Can anyone help?*** */
if ( keypress1 == 1 )
{
++LoopStop1;
}
}
}
}/////////////////////////////////////////////////////***END***//////////////////////////////////////////////