hi guys I'm desperately needing you help....
I'm doing a C++ version of Peg Solitaire and i want the peg to be able to DRAG and DROP using the mouse...
What i did is, i assign move in keyboard functions because i don't have any idea how to implement the DRAG and DROP...pls.... i really need your help...
here's what i did.....
PLEASE Help Me.....
I'm doing a C++ version of Peg Solitaire and i want the peg to be able to DRAG and DROP using the mouse...
What i did is, i assign move in keyboard functions because i don't have any idea how to implement the DRAG and DROP...pls.... i really need your help...
here's what i did.....
Code:
if( NewBoard )
{
for (int i = 0, y = 155; i < 5; i++,y+=70)
{
for (int j = 0,x = 350 ; j < 3; j++, x+=90)
{
if( _2DArray[i][j] != 0)
monmon->Render(bbDC,m_spriteDC, x, y);
}
}
}
//////1st Move;///
if(IsBufferedKeyDown('A')|| xxx == 1)
{
xxx = 1;
for (int i = 0, y = 155; i < 5; i++,y+=70)
{
for (int j = 0,x = 350 ; j < 3; j++, x+=90)
{
if(_2DArray[4][0]==1 && _2DArray[4][1]==1||_2DArray[4])
{
_2DArray[4][0]=0;
_2DArray[4][1]=0;
_2DArray[4][2]=1;
}
if(_2DArray[i][j] !=0)
{
monmon->Render(bbDC,m_spriteDC, x, y);
}
}
}
NewBoard= false;
}
///////end of 1st moved
//////////////////2nd Move//////
if(IsBufferedKeyDown('S')|| xxx == 2)
{
xxx = 2;
for (int i = 0, y = 155; i < 5; i++,y+=70)
{
for (int j = 0,x = 350 ; j < 3; j++, x+=90)
{
if(_2DArray[2][1]==1 && _2DArray[3][1]==1)
{
_2DArray[2][1]=0;
_2DArray[3][1]=0;
_2DArray[4][1]=1;
}
if(_2DArray[i][j] !=0)
{
monmon->Render(bbDC,m_spriteDC, x, y);
}
}
}
NewBoard= false;
}
///end of 2nd moved
Comment