Rui_Cunha
asked on
URGENT: CONSOLE APP
i´m doing the reversi game (kind of checkers) and my project consists on a Win32 Concole
Application,since i don´t want to use windows functions ,or MFC or other kind of project type my question
is:
imagine that on the left upper corner of the console i have 2 menu options : Start Game and
Quit Game.
i just want to ignore the keyboard and use the mouse as my main input.
I would like to know how can i ( using only console related functions....)
validate if the player made a click on the "Start Game" screen area ,for example,
without any kind of loop...i´d like to use a sort of an event,that is constantly
checking the input on those screen coordinates,while the game is going on...
i don´t want to have code like the following:
do
do
{
playerX_move();
..........
validation code goes here
..........
show_score();
}while (!move_is_legal(playerX) );
while ( mouseclick_area != menu_options_screen_area)
the first do...while is the one that i want to avoid...imagine that the player made the
click on "Quit Game" before making the move...only when the nested do...while was done
(after validating the move and showing the score) only after that my program could validate the
mouseclick_area and i don´t want that...i want to do things instantly....
if any of you guys could help me out i´d be thankful,because this is my last college project
this year :)
best regards
Rui
Lisbon,Portugal
Application,since i don´t want to use windows functions ,or MFC or other kind of project type my question
is:
imagine that on the left upper corner of the console i have 2 menu options : Start Game and
Quit Game.
i just want to ignore the keyboard and use the mouse as my main input.
I would like to know how can i ( using only console related functions....)
validate if the player made a click on the "Start Game" screen area ,for example,
without any kind of loop...i´d like to use a sort of an event,that is constantly
checking the input on those screen coordinates,while the game is going on...
i don´t want to have code like the following:
do
do
{
playerX_move();
..........
validation code goes here
..........
show_score();
}while (!move_is_legal(playerX) );
while ( mouseclick_area != menu_options_screen_area)
the first do...while is the one that i want to avoid...imagine that the player made the
click on "Quit Game" before making the move...only when the nested do...while was done
(after validating the move and showing the score) only after that my program could validate the
mouseclick_area and i don´t want that...i want to do things instantly....
if any of you guys could help me out i´d be thankful,because this is my last college project
this year :)
best regards
Rui
Lisbon,Portugal
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You might have code like
HANDLE StdInp = GetStdHandle(STD_INPUT_HAN DLE);
INPUT_RECORD InpRec;
DWORD EvtRed;
ReadConsoleInput(StdInp,&I npRec,1,&E vtRed);
if (EvtRed == 1 && InpRec.EvenType == MOUSE_EVENT)
{
if (InpRec.MouseEvent.DwButto nState & FROM_LEFT_1ST_BUTTON_PRESS ED)
{
* * *
}
}
HANDLE StdInp = GetStdHandle(STD_INPUT_HAN
INPUT_RECORD InpRec;
DWORD EvtRed;
ReadConsoleInput(StdInp,&I
if (EvtRed == 1 && InpRec.EvenType == MOUSE_EVENT)
{
if (InpRec.MouseEvent.DwButto
{
* * *
}
}
Just an idea, but have you thought of using an interrupt?