Esempio n. 1
0
void MMsgBox::OnSize(int w, int h)
{
#if 0 //예전 코드
 	MRECT r = GetInitialClientRect();
	m_pMessage->SetBounds(MRECT(r.x+19, r.y+40, r.w-38, r.h-70));
	int nOKOffset = 0;
	if(m_nType==MT_OKCANCEL || m_nType==MT_YESNO) nOKOffset = MMSGBOX_OK_W+5;
	if(m_pOK!=NULL) m_pOK->SetBounds(MRECT(r.x+r.w-MMSGBOX_OK_W-nOKOffset - 19, r.y+r.h-MMSGBOX_OK_H-20, MMSGBOX_OK_W, MMSGBOX_OK_H));
	if(m_pCancel!=NULL) m_pCancel->SetBounds(MRECT(r.x+r.w-MMSGBOX_OK_W - 19, r.y+r.h-MMSGBOX_OK_H-20, MMSGBOX_OK_W, MMSGBOX_OK_H));

#else

	// 해상도 변경에 따라 메시지 박스의 크기가 조정되도록 변경

	MRECT r = GetInitialClientRect();
	/*r.x = CONVERT800(r.x);
	r.w = CONVERT800(r.w);
	r.y = CONVERT600(r.y);
	r.h = CONVERT600(r.h);*/

	m_pMessage->SetBounds(MRECT(
		r.x + CONVERT800(19),
		r.y + CONVERT600(40),
		r.w - CONVERT800(38),
		r.h - CONVERT600(70)));

	int nOKOffset = 0;
	if(m_nType==MT_OKCANCEL || m_nType==MT_YESNO) 
		nOKOffset = MMSGBOX_OK_W+ CONVERT800(5);

	if(m_pOK!=NULL) m_pOK->SetBounds(MRECT(
		r.x+r.w-MMSGBOX_OK_W-nOKOffset - CONVERT800(19), 
		r.y+r.h-MMSGBOX_OK_H-CONVERT600(20), 
		MMSGBOX_OK_W, 
		MMSGBOX_OK_H));
	
	if(m_pCancel!=NULL) m_pCancel->SetBounds(MRECT(
		r.x+r.w-MMSGBOX_OK_W - CONVERT800(19), 
		r.y+r.h-MMSGBOX_OK_H-CONVERT600(20), 
		MMSGBOX_OK_W, 
		MMSGBOX_OK_H));
#endif
}
Esempio n. 2
0
void ZStageInfoBox::OnDraw(MDrawContext* pDC)
{
	if(m_pLook)
	{
		MRECT r = GetInitialClientRect();

		int nShowCount=0;
		for(int i=GetStartItem(); i<GetCount(); i++){

			nShowCount++;

			if(nShowCount>=GetShowItemCount()) break;

			MRECT itemrect=MRECT(r.x,r.y+GetItemHeight()*(nShowCount-1),r.w,GetItemHeight());
			DrawBitmapFrame9(pDC, itemrect, m_pLook->m_pFrameBitmaps);
		}
	}
	
	MListBox::OnDraw(pDC);
}
Esempio n. 3
0
void MPopupMenu::AddMenuItem(MMenuItem* pMenuItem)
{
	AddChild(pMenuItem);
	pMenuItem->SetListener(this);

	MRECT cr = GetClientRect();
	MRECT ir = GetInitialClientRect();
	if(m_nPopupMenuType==MPMT_VERTICAL){
		int y = 0;
		int nWidth = 0;
		for(int i=0; i<m_Children.GetCount(); i++){
			MMenuItem* pMenuItem = (MMenuItem *)m_Children.Get(i);
			pMenuItem->SetPosition(cr.x, cr.y+y);
			nWidth = std::max(nWidth, pMenuItem->GetWidth());
			y += pMenuItem->GetHeight();
		}
		for(int i=0; i<m_Children.GetCount(); i++){
			MMenuItem* pMenuItem = (MMenuItem *)m_Children.Get(i);
			pMenuItem->SetSize(nWidth, pMenuItem->GetHeight());
		}
		SetSize(nWidth+ir.w-cr.w-1, y+ir.h-cr.h-1);
	}
	else{
		int x = 0;
		int nHeight = 0;
		for(int i=0; i<m_Children.GetCount(); i++){
			MMenuItem* pMenuItem = (MMenuItem *)m_Children.Get(i);
			pMenuItem->SetPosition(cr.x+x, cr.y);
			nHeight = std::max(nHeight, pMenuItem->GetHeight());
			x += pMenuItem->GetWidth();
		}
		for(int i=0; i<m_Children.GetCount(); i++){
			MMenuItem* pMenuItem = (MMenuItem *)m_Children.Get(i);
			pMenuItem->SetSize(pMenuItem->GetWidth(), nHeight);
		}
		SetSize(x+ir.w-cr.w-1, nHeight+ir.h-cr.h-1);
	}
}
Esempio n. 4
0
void ZRoomListBox::OnDraw( MDrawContext* pDC )
{
	MBitmap* pBitmap;
	MRECT		rect;
	map<string, MBitmap*>::iterator iter;
	map<MMATCH_GAMETYPE, MBitmap*>::iterator iterIcon;
	int pressed_reposition = 0;

 	int index = 0;
	
	for( int i = 0; i < NUM_DISPLAY_ROOM; ++i )
	{
		bool	bRoomFull = false;

		if( m_Selection == i )			pressed_reposition = 1; 
		else							pressed_reposition = 0;

		const char*	mapName = MGetBannerName( m_pMapInfo[i].map_name);
		if( m_pMapInfo[i].IsEmpty )
		{
			continue;
		}
		rect = GetInitialClientRect();
		
		int width  = (int)( m_iGapWidth + ( m_RoomWidth + m_iGapWidth*2 + m_iGapCenter ) * ( index%2 ) );
		int height = (int)( m_iGapHeight + ( m_RoomHeight + m_iGapHeight ) * (int)(index*0.5f));
 		
 		if( m_pMapInfo[i].nPeople >= m_pMapInfo[i].nMaxPeople )
		{
			bRoomFull = true;
		}
		
		iter = find_if( m_pMapImage.begin(), m_pMapImage.end(), string_key_equal<string, MBitmap*>(mapName));
		if( iter != m_pMapImage.end() )
		{
			pBitmap	= iter->second;
			if( pBitmap != 0 )
			{
				if( ( m_pMapInfo[i].roomState == GMAE_CLOSED ) || bRoomFull )	
 					pDC->SetBitmapColor(125,125,125,255);
				else					
 					pDC->SetBitmapColor(255,255,255,255);

				pDC->SetBitmap( pBitmap ); 
				pDC->Draw( width + pressed_reposition, height + pressed_reposition, m_RoomWidth, m_RoomHeight );
			}

			if(m_pRoomFrame!=0)
			{
				pDC->SetBitmap(m_pRoomFrame);
 				pDC->Draw(width + pressed_reposition, height + pressed_reposition, m_RoomWidth * 0.75, m_RoomHeight, 0, 0, 512, 32 );
			}
		}

		char szBuf[128];
		MRECT r;

 		r.x = width + m_RoomWidth*0.01f	+ pressed_reposition;
		r.y = height + m_RoomHeight*0.1f + pressed_reposition;
		r.w = m_RoomWidth*0.1;
		r.h = m_RoomHeight *0.5;
     	sprintf_safe(szBuf,"%03d", m_pMapInfo[i].RoomNumber);

		pDC->SetFont( MFontManager::Get("FONTc8b") );
		pDC->SetColor( 0,0,0);
		pDC->Text( MRECT( r.x+1, r.y+1, r.w, r.h), szBuf);
		if(  m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
			pDC->SetColor( 115,146,173 );
		else
			pDC->SetColor( 181, 247, 66 );
		pDC->Text( r, szBuf );

		r.x = width + m_RoomWidth*0.01f + pressed_reposition;
		r.y = height + m_RoomHeight*0.5f + pressed_reposition;
		r.w = m_RoomWidth*0.1f;
		r.h = m_RoomHeight*0.5f;
		sprintf_safe(szBuf,"%d/%d", m_pMapInfo[i].nPeople, m_pMapInfo[i].nMaxPeople );

		pDC->SetColor( 0,0,0);
		pDC->Text( MRECT( r.x+1, r.y+1, r.w, r.h), szBuf);
		if(  m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
			pDC->SetColor( 115,146,173 );
		else
			pDC->SetColor( 181, 247, 66 );
		pDC->Text( r, szBuf );

		pDC->SetFont( MFontManager::Get("FONTc8b") );
 		r.x = width + m_RoomWidth*0.12 + pressed_reposition;
 		r.y = height + pressed_reposition;
  		r.w = m_RoomWidth*0.75;
		r.h = m_RoomHeight;
 		
		MFont * pFont  = pDC->GetFont();
		char szBufTemp[SMI_MAPNAME_LENGTH];
		int strLength = 0;
		int RoomWidth = pFont->GetWidth(m_pMapInfo[i].room_name);
		if( RoomWidth > m_RoomWidth*0.7 )
		{
			while( strLength < 29 )
			{
				if( m_pMapInfo[i].map_name[strLength] == '0' )
					strcpy_safe( szBufTemp, m_pMapInfo[i].room_name );
				if( ((unsigned char)m_pMapInfo[i].room_name[strLength]) > 127 )
					strLength += 2;
				else
					++strLength;
			}
			strncpy_safe( szBufTemp, m_pMapInfo[i].room_name, strLength*sizeof(char) );
			szBufTemp[strLength] = '\0';
			strcat_safe( szBufTemp, "..."	);

			pDC->SetColor( 0,0,0);
			pDC->Text( MRECT( r.x+1, r.y+1, r.w, r.h), szBufTemp, MAM_LEFT);
			if(  m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
				pDC->SetColor( 115,146,173 );
			else
				pDC->SetColor( 255, 255, 255 );
			pDC->Text(r, szBufTemp, MAM_LEFT );
		}
		else
		{
			pDC->SetColor( 0,0,0);
			pDC->Text( MRECT( r.x+1, r.y+1, r.w, r.h), m_pMapInfo[i].room_name, MAM_LEFT);
			if(  m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
				pDC->SetColor( 115,146,173 );
			else
				pDC->SetColor( 255, 255, 255 );
			pDC->Text(r, m_pMapInfo[i].room_name, MAM_LEFT );
		}

		r.x = width + m_RoomWidth*0.75f + pressed_reposition;
		r.y = height + pressed_reposition;
		r.w = m_RoomWidth * 0.2f ;
		r.h = m_RoomHeight;

		if( m_pMapInfo[i].bLimitLevel )
		{
			char szBufTemp[64];
			sprintf_safe( szBufTemp, "%d~%d", max(m_pMapInfo[i].nMasterLevel - m_pMapInfo[i].nLimitLevel,1), m_pMapInfo[i].nMasterLevel + m_pMapInfo[i].nLimitLevel);

			pDC->SetColor( 0,0,0);
			pDC->Text( MRECT( r.x+1, r.y+1, r.w, r.h), szBufTemp);
			if( m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
				pDC->SetColor( 100, 100, 100 );
			else
				pDC->SetColor( 181, 247, 66 );
			pDC->Text( r, szBufTemp );
		}
		
		if (m_pMapInfo[i].bPrivate)
		{
			// 비밀방이면 게임모드 아이콘대신 열쇠아이콘이 나온다.
			// 열쇠아이콘은 하드코드됨. 나중에 일반화해서 xml로 빼놔야할 듯..

			#define FN_ROOMLIST_PRIVATE_KEY		"in_key.png"
			pBitmap = MBitmapManager::Get(FN_ROOMLIST_PRIVATE_KEY);
			if (pBitmap != NULL) 
			{
				float x, y;
				x = width + m_RoomWidth*0.9 + pressed_reposition;
				y = height + pressed_reposition + ((m_RoomHeight-pBitmap->GetHeight())/2);
				pDC->SetBitmap( pBitmap );
				pDC->Draw(x, y, pBitmap->GetWidth(), pBitmap->GetHeight());
			}
		}
		else
		{
			iterIcon = m_pIconImage.find( m_pMapInfo[i].nGame_Type );
			if( iterIcon != m_pIconImage.end() )
			{
				pBitmap = iterIcon->second;
				if( pBitmap != 0)
				{
 					r.x = width + m_RoomWidth*0.9 + pressed_reposition;
					r.y = height + m_RoomHeight/4.7 + pressed_reposition;

					// 아이콘
					if( m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull )
					{
						pDC->SetBitmapColor(100,100,100,100);
					}
					else
					{
  						pDC->SetBitmapColor(255,255,255,255);
					}

					pDC->SetBitmap( pBitmap );
					pDC->Draw(r.x, height + pressed_reposition, m_RoomHeight, m_RoomHeight);
				}			
			}
		}


		// 플레이 중이면 플레이 아이콘을 표시한다.
		if ( m_pMapInfo[i].roomState == GAME_PLAYING)
		{
			// 역시 플레이 아이콘도 하드코딩... -_-;
			#define FN_ROOMLIST_PLAYICON		"icon_play.tga"
			pBitmap = MBitmapManager::Get( FN_ROOMLIST_PLAYICON);
			if (pBitmap != NULL) 
			{
				float x, y;
				x = width  + (m_RoomWidth  * 0.955) + pressed_reposition;
				y = height + (m_RoomHeight * 0.54)  + pressed_reposition;
				pDC->SetBitmap( pBitmap );
				pDC->Draw(x, y, (m_RoomHeight * 0.5), (m_RoomHeight * 0.5));
			}
		}

		//왓구(테두리)
		if( i == m_Selection)
		{
			if( m_pMapInfo[i].roomState == GMAE_CLOSED || bRoomFull) pDC->SetColor(115,146,173);
			else pDC->SetColor( 181, 247, 66 );
		}
		else pDC->SetColor(128,128,128,255);
		pDC->Rectangle(width+pressed_reposition, height+pressed_reposition, m_RoomWidth, m_RoomHeight );

		++index;
	}
	pDC->SetOpacity( 255 );
	pDC->SetBitmapColor(255,255,255,255);
}
Esempio n. 5
0
bool ZRoomListBox::OnEvent( MEvent* pEvent, MListener* pListener )
{
	MRECT r = GetInitialClientRect();

	MPOINT ClickPos = pEvent->Pos;

	MRECT	rect;

	switch(pEvent->nMessage)
	{
		if(r.InPoint(ClickPos)==true)
		{
			case MWM_LBUTTONDOWN:
			{	
				for( int i = 0 ; i < NUM_DISPLAY_ROOM; ++i )
				{
					int width = (int)((m_RoomWidth + ROOM_WIDTH)*(i%2)+ ROOM_WIDTH);
					int height = (int)((m_RoomHeight + ROOM_HEIGHT)*((int)i/2) + ROOM_HEIGHT);
					rect.x = width;
					rect.y = height;
					rect.w = m_RoomWidth;
					rect.h = m_RoomHeight;
					if(	rect.InPoint( ClickPos ) )
					{
						if( m_pMapInfo[i].IsEmpty )
							continue;
						m_Selection	= i;
						SetPrivateStageUID(MUID(0,0));

						return true;
					}
					m_Selection = -1;
				}
				return true;
			}
			case MWM_LBUTTONDBLCLK:
			{
				for( int i = 0 ; i < NUM_DISPLAY_ROOM; ++i )
				{
					int width = (int)((m_RoomWidth + ROOM_WIDTH)*(i%2)+ ROOM_WIDTH);
					int height = (int)((m_RoomHeight + ROOM_HEIGHT)*((int)i/2) + ROOM_HEIGHT);
					rect.x = width;
					rect.y = height;
					rect.w = m_RoomWidth;
					rect.h = m_RoomHeight;
					if( rect.InPoint( ClickPos ) )
					{
						if( m_pMapInfo[i].IsEmpty )
							continue;
						m_Selection	= i;
						SetPrivateStageUID(MUID(0,0));

						RequestSelStageJoin();
						return true;
					}
					m_Selection = -1;
				}
				return true;
			}
		}
	}
	return false;
}
Esempio n. 6
0
void CCWidget::OnDraw(CCDrawContext* pDC){
	// Draw Nothing
	pDC->SetColor(sColor(196, 196, 196));
	pDC->FillRectangle(GetInitialClientRect());
}