Click here to Skip to main content
16,011,647 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
CPallini6-Jul-08 4:08
mveCPallini6-Jul-08 4:08 
GeneralRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
Rajesh R Subramanian6-Jul-08 4:27
professionalRajesh R Subramanian6-Jul-08 4:27 
GeneralFYI - We both have been given the award MFTH Pin
Rajesh R Subramanian7-Jul-08 2:34
professionalRajesh R Subramanian7-Jul-08 2:34 
GeneralIndeed. Pin
CPallini7-Jul-08 2:51
mveCPallini7-Jul-08 2:51 
GeneralRe: Indeed. Pin
Rajesh R Subramanian16-Jul-08 0:51
professionalRajesh R Subramanian16-Jul-08 0:51 
GeneralRe: Indeed. Pin
CPallini16-Jul-08 1:43
mveCPallini16-Jul-08 1:43 
AnswerRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
Eytukan12-Jun-08 6:36
Eytukan12-Jun-08 6:36 
AnswerRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
youareabigboy13-Jun-08 3:28
youareabigboy13-Jun-08 3:28 
{ protected: // ???????
CdeDoc();
DECLARE_DYNCREATE(CdeDoc)

// ??
public:

// ??
public:
CRect R[3][8];
CRect r;
CRect r1;
float J;
int K[3][9];
int M;
BOOL CdeDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
r=CRect(300,350,350,390);
r1=CRect(100,400,600,500);
M=1;
K[3][9]=(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);void CdeView::OnEnd()
{
KillTimer(1);// TODOvoid CdeView::OnDraw(CDC* pDC)
{CdeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);

CRect rect;
GetClientRect(&rect);
int W=rect.right/8;

for(int a2=0;a2<9;a2++)
{CBrush C1;
C1.CreateSolidBrush(RGB(255,0,0));
CBrush *old;
old=pDC->SelectObject(&C1);
pDC->Rectangle(W*a2,0,W*(a2+1),50);
pDC->SelectObject(old);
}
for(int a=0;a<9;a++)
{ CBrush C2;
C2.CreateSolidBrush(RGB(0,255,0));
CBrush *n;
n=pDC->SelectObject(&C2);
pDC->Rectangle(W*a,50,W*(a+1),100);
pDC->SelectObject(n);
}
for(int a1=0;a1<9;a1++)
{CBrush C3;
C3.CreateSolidBrush(RGB(0,0,255));
CBrush *m;
m=pDC->SelectObject(&C3);
pDC->Rectangle(W*a1,100,W*(a1+1),150);

pDC->Rectangle(pDoc->r1);
pDC->SelectObject(m);
}
pDC->Ellipse(pDoc->r);
pDC->TextOut(pDoc->M,200,"00");

/*CBrush C4;
C4.CreateSolidBrush(RGB(1,234,100));
CBrush *m1;

m1=pDC->SelectObject(&C4);
//pDC->Rectangle(100*a1,80,100*(a1+1),120);

pDC->Rectangle(pDoc->R);
pDC->Ellipse(pDoc->r);
//pDC->SelectObject(m1);*///int H=50;


// TODO: ??????????????
}


// CdeView ??

BOOL CdeView::OnPreparePrinting(CPrintInfo* pInfo)
{
// ????
return DoPreparePrinting(pInfo);
}

void CdeView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: ???????????
}

void CdeView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: ?????????
}


// CdeView ??

#ifdef _DEBUG
void CdeView::AssertValid() const
{
CView::AssertValid();
}

void CdeView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}

CdeDoc* CdeView::GetDocument() const // ?????????
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CdeDoc)));
return (CdeDoc*)m_pDocument;
}
#endif //_DEBUG
: Add your command handler code here
}

void CdeView::OnStart()
{
SetTimer(1,100,NULL);// TODO: Add your command handler code here
}

void CdeView::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{CdeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);


InvalidateRect(pDoc->r1,TRUE);
switch(nChar)
{
case VK_LEFT:
pDoc->r1.left-=5;
pDoc->r1.right-=5;



break;
case VK_RIGHT:
pDoc->r1.left+=5;
pDoc->r1.right+=5;

break;
}
InvalidateRect(pDoc->r1,FALSE);
CView::OnKeyDown(nChar, nRepCnt, nFlags);

}

void CdeView::OnTimer(UINT nIDEvent)
{CdeDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
CRect rect;
GetClientRect(&rect);
int W=rect.right/8;
if(pDoc->r.top>=150)
{pDoc->M=1;}

for(int i=0;i<3;i++)
{ for(int j=0;j<9;j++)
if(50*i<pDoc->r.top&&pDoc->r.top<50*(1+i)&&pDoc->r.left>W*j&&pDoc->r.left<W*(1+j)&&pDoc->K[i][j]!=0)
;{ pDoc->M=2;
InvalidateRect(pDoc->R[3][9],TRUE);
pDoc->K[i][j]=0;
}
}
if(pDoc->r.left==W*8)
{pDoc->M=3;}
if(pDoc->r.top==400)
{pDoc->M=4;}
for(int i=0;i<3;i++)
{ for(int j=0;j<9;j++)
if(50*i<pDoc->r.top&&pDoc->r.top<50*(1+i)&&pDoc->r.left>=W*j&&pDoc->r.left<W*(1+j)&&pDoc->K[i][j]!=0)
;{ pDoc->M=5;
InvalidateRect(pDoc->R[3][9],TRUE);
pDoc->K[i][j]=0;
}
}

if(pDoc->r.left==0)
{pDoc->M=6;}
if(pDoc->r.top==400)
{pDoc->M=7;}
switch(pDoc->M)
{ case 1:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left+=1;
pDoc->r.top-=1.7;
pDoc->r.right+=1;
pDoc->r.bottom-=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 2:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left+=1;
pDoc->r.top+=1.7;
pDoc->r.right+=1;
pDoc->r.bottom+=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 3:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left-=1;
pDoc->r.top+=1.7;
pDoc->r.right-=1;
pDoc->r.bottom+=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 4:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left-=1;
pDoc->r.top-=1.7;
pDoc->r.right-=1;
pDoc->r.bottom-=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 5:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left-=1;
pDoc->r.top+=1.7;
pDoc->r.right-=1;
pDoc->r.bottom+=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 6:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left+=1;
pDoc->r.top+=1.7;
pDoc->r.right+=1;
pDoc->r.bottom+=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
case 7:
InvalidateRect(pDoc->r,TRUE);
pDoc->r.left+=1;
pDoc->r.top-=1.7;
pDoc->r.right+=1;
pDoc->r.bottom-=1.7;
InvalidateRect(pDoc->r,FALSE);
break;
}







CView::OnTimer(nIDEvent);
}
this is what I write to control the movement of the globule in the SDI of Visutal Studio .NET 2003,but it can't work.there is also no wrong,I really don't know why.
If you have time to spare ,i will expect your reply.
Thanks for you any way!

I am expecting your wonderfull answer!

GeneralRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
Nelek12-Jun-08 5:44
protectorNelek12-Jun-08 5:44 
AnswerRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
bulg12-Jun-08 14:20
bulg12-Jun-08 14:20 
GeneralRe: How to write a game called"globule beats brick"using VC++6.0 or Visual Studio 2003 in SDI? Pin
bulg12-Jun-08 14:21
bulg12-Jun-08 14:21 
QuestionWhy CWinApp in a Win32 console Pin
BadKarma12-Jun-08 2:12
BadKarma12-Jun-08 2:12 
AnswerRe: Why CWinApp in a Win32 console Pin
Graham Bradshaw12-Jun-08 2:40
Graham Bradshaw12-Jun-08 2:40 
AnswerRe: Why CWinApp in a Win32 console [modified] Pin
Nibu babu thomas12-Jun-08 2:45
Nibu babu thomas12-Jun-08 2:45 
Questioncouldn't install vc++ 2008? Pin
gentleguy12-Jun-08 1:56
gentleguy12-Jun-08 1:56 
QuestionRe: couldn't install vc++ 2008? Pin
CPallini12-Jun-08 2:39
mveCPallini12-Jun-08 2:39 
AnswerRe: couldn't install vc++ 2008? Pin
theCPkid12-Jun-08 3:06
theCPkid12-Jun-08 3:06 
AnswerRe: couldn't install vc++ 2008? Pin
Mark Salsbery12-Jun-08 6:11
Mark Salsbery12-Jun-08 6:11 
GeneralRe: couldn't install vc++ 2008? Pin
led mike12-Jun-08 6:48
led mike12-Jun-08 6:48 
QuestionHow to search and delete a file Pin
Shirani12-Jun-08 1:18
Shirani12-Jun-08 1:18 
AnswerRe: How to search and delete a file Pin
_AnsHUMAN_ 12-Jun-08 1:44
_AnsHUMAN_ 12-Jun-08 1:44 
AnswerRe: How to search and delete a file Pin
vijay_aroli12-Jun-08 2:36
vijay_aroli12-Jun-08 2:36 
GeneralRe: How to search and delete a file Pin
Shirani12-Jun-08 6:39
Shirani12-Jun-08 6:39 
GeneralRe: How to search and delete a file Pin
Eytukan12-Jun-08 7:52
Eytukan12-Jun-08 7:52 
QuestionAfxCallWndProc and custom control development Pin
sawerr12-Jun-08 1:11
sawerr12-Jun-08 1:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.