Click to See Complete Forum and Search --> : Confused!
August 29th, 1999, 08:12 AM
Hi, i am very confused about this, hope some one can clear this up for me.
I am making a simple game that depend on mouse click, so that is handled by the onButtonUp. The question is when i want to make an option of 1 or 2 players on the main menu, VC gives a simple function without any parameters.
How am i going to get the similar input as to onButtonUp ( which is the CPoint)
Thanks.
Hatim
August 29th, 1999, 01:46 PM
Firstly you should try to change the way that you allow different User selection. If your game has maximum of 2 Users then you should use a readonly Combobox as your control otherwise if there are more than 2 users you could use a spin control.
If you still need to use the Mouse then reply to me and i will guide you. Thanks
August 29th, 1999, 06:49 PM
Hi Hatim,
the game is either human and human or human and computer.
so by clicking on the option (human and human or...), it obviously bring me to a function w/o parameters. These two options i guess is going to be a separate function as for human vs computer, only 1 mouse click is needed to happen (2nd mouse click is generated by the computer).
I don't know how clear is this, but i can't get my self explain better.
And i only plan to use the menu.
Thanks.
Woffy
August 29th, 1999, 07:08 PM
void CADialog::OnLButtonUp(UINT nFlags, CPoint point)
or
void CAView::OnLButtonUp(UINT nFlags, CPoint point)
This appears to be the definition of the mouse up event, are you saying yours is
void CADialog::OnLButtonUp(void)
or
void CAView::OnLButtonUp(void)
If your prototype is the first option, then you can tell what they selected by the value of point.
CRect rectHumanPlayer(,,,,)
CRect rectComputerPlayer(,,,,)
if (rectHumanPlayer.PtIn(point))
{
} else
if (rectComputerPlayer.PtIn(point))
{
}
Is this any help?
August 30th, 1999, 12:10 AM
Hi, maybe i can put it in this way. How do i find out which option is selected from the menu (which one is being clicked).
Thanks.
Woffy
August 30th, 1999, 02:27 AM
Sorry, I guess I was the one who was confused.
When u select an option from a menu, windows will post a message to you of the form,
PostMessage(WM_COMMAND, ID_OPTION_CHOSEN)
Where ID_OPTION_CHOSEN is the option that the user selected.
Basically using the ON_COMMAND handler with a line like,
ON_COMMAND(ID_OPTION_CHOSEN, OnOptionChosen)
in the message map,
and create a function like
void CMyFrame::OnOptionChosen()
{
// The option was chosen!!!
}
You would have one command handler per option on the menu!
Does this help?
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.