Esempio n. 1
0
void CeasyNtList::OnPaint()
{
	CPaintDC dc(this); // device context for painting
		
	CGameImageHelper	help(&m_bk);
	help.BitBlt(dc.GetSafeHdc(),0,0);
	
	CGameImageHelper jeton(&m_PicNum);
	CDC destdc;

	destdc.CreateCompatibleDC(&dc);
	destdc.SelectObject(jeton);
	::TransparentBlt(dc.GetSafeHdc(),m_BtnRect0.left,m_BtnRect0.top,JETON_W,JETON_H,destdc.GetSafeHdc(),
		m_BtnIndex0 * JETON_W,0,JETON_W,JETON_H,RGB(255,0,255));

	::TransparentBlt(dc.GetSafeHdc(),m_BtnRect1.left,m_BtnRect1.top,JETON_W,JETON_H,destdc.GetSafeHdc(),
		m_BtnIndex1 * JETON_W,0,JETON_W,JETON_H,RGB(255,0,255));

	::TransparentBlt(dc.GetSafeHdc(),m_BtnRect2.left,m_BtnRect2.top,JETON_W,JETON_H,destdc.GetSafeHdc(),
		m_BtnIndex2 * JETON_W,0,JETON_W,JETON_H,RGB(255,0,255));

	DrawNum(&dc);
	destdc.DeleteDC();

}
Esempio n. 2
0
int Statbar::DrawFontString(char* s,int x,int y,float f){
	int c;
	for(c=0;c<strlen(s);c++){
		if('0'<=s[c] && s[c]<='9'){
			x+=DrawNum(s[c]-'0',x,y,f);
		}else if('a'<=s[c] && s[c]<='z'){
			x+=DrawSmallChar(s[c]-'a',x,y,f);
		}else if('A'<=s[c] && s[c]<='Z'){
			x+=DrawLargeChar(s[c]-'A',x,y,f);
		}else{
			x+=NUM_WID*0.8f*f;
		}
	}
	return 0;
}
Esempio n. 3
0
void Draw() 
{	

    
    if(gameoverflag==true)
      GameOver();
  else
  { 
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);   
    Background();
	
	if(xcord_first+0.06>=1.0 || xcord_first<=0.0)
		deltax_first=-deltax_first;
	xcord_first+=deltax_first;
	if(xcord_second+0.06>=1.0 || xcord_second<=0.0)
		deltax_second=-deltax_second;
	xcord_second+=deltax_second;
	if(xcord_third+0.06>=1.0 || xcord_third<=0.0)
		deltax_third=-deltax_third;
	xcord_third+=deltax_third;
	
	if(slideFlag==true)
	  decrement();
	
  DrawBucket(xcord_first,ycord_first);
	DrawBucket(xcord_second,ycord_second);
	DrawBucket(xcord_third,ycord_third);
	
	if(egginbasketnumber==1)
	{
		eggcentrex=xcord_first+0.03;
		if(flag==true)
		{
         eggcentrey+=velocity;
         velocity-=g;
        }
	}
	else if(egginbasketnumber==2) 
	{
		eggcentrex=xcord_second+0.03;
		if(flag==true)
		{
         eggcentrey+=velocity;
         velocity-=g;
        }
	}
	else
	{
		eggcentrex=xcord_third+0.03;
 	    if(flag==true)
        {
         eggcentrey+=velocity;
         velocity-=g;
        }
	}               
                     	
	if(flag==true)
	{
    if(velocity<0 && eggcentrex>=(xcord_first+0.01) && eggcentrex<=(xcord_first+0.05) && eggcentrey>=(ycord_first+0.06) && eggcentrey<=(ycord_first+0.08))
    {
       if(egginbasketnumber==1)
       life--;
       else
       points++;           
       egginbasketnumber=1;
       eggcentrex=xcord_first+0.03;
       eggcentrey=ycord_first+0.045;
       velocity=VEL;
       flag=false;
    }
    if(velocity<0 && eggcentrex>=(xcord_second +0.01)&& eggcentrex<=(xcord_second+0.05) && eggcentrey>=(ycord_second+0.06) && eggcentrey<=(ycord_second+0.08))
    {
        if(egginbasketnumber==2)
       life--;          
       else
       points++;
       egginbasketnumber=2;
       eggcentrex=xcord_second+0.03;
       eggcentrey=ycord_second+0.045;
       velocity=VEL;
       flag=false;
    }
    if(velocity<0 && eggcentrex>=(xcord_third+0.01) && eggcentrex<=(xcord_third+0.05) && eggcentrey>=(ycord_third+0.06) && eggcentrey<=(ycord_third+0.08))
    {
       if(egginbasketnumber==3)
       life--;
       else
       points++;
       egginbasketnumber=3;
       eggcentrex=xcord_third+0.03;
       eggcentrey=ycord_third+0.045;
       velocity=VEL;
       flag=false;
    }
    if(eggcentrey<0.05)
    {

      addToBasket(basketBelow);
      velocity=VEL;
      flag=false;
    }
    }
       
    ellipse(eggcentrex, eggcentrey, 0.015, 0.025);
    DrawNum(life,0.025,0.95);
    DrawNum(points,0.87,0.95);
    if(life==0)
    { 
      printf("Game Over and u have scored %d points\n",points);
      gameoverflag=true;
    }
    if(egginbasketnumber==basketAbove)
      slideFlag=true;
    glutSwapBuffers();
	glutPostRedisplay();
  }
}
void MyTask_InfoEffect::Draw() const{
	TCHAR str[INFOEFFECT_STRSIZE];
	float f;
	int w;
	int a = 255;
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
	switch(typeID){
	case INFO_DAMAGENUM_ENEMY:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_m,
			NUM_DAMAGE_M_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_ENEMY_STRONG:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_l,
			NUM_DAMAGE_L_WIDTH-12, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_ENEMY_RESIST:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_s,
			NUM_DAMAGE_S_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_m,
			NUM_DAMAGE_M_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL_STRONG:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_l,
			NUM_DAMAGE_L_WIDTH-12, 4, 1, false, false);
		break;
	case INFO_DAMAGENUM_DOLL_RESIST:
		a = PARAM(12*(GetLifeTime()-existTime));
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		f = min(0, 0.4*existTime*(existTime-20));
		DrawNum(param, x, y+f,
			g_image.chars.num_damage_s,
			NUM_DAMAGE_S_WIDTH-8, 4, 1, false, false);
		break;
	case INFO_LEVELUP:
		a = min(255, 16*GetRestTime());
		f = min(1.0, 0.2+0.06*GetExistTime());
		SetDrawBlendMode(DX_BLENDMODE_ALPHA, a);
		DrawRotaGraph(
			x, y-1.5*GetExistTime(), 
			f, 0, g_image.icon.levelup, 1, 0);
		SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
		break;
	}
	SetDrawBlendMode(DX_BLENDMODE_NOBLEND, 255);
}