Пример #1
0
void WndLightAdjust::EndPopUp()
{
	ModifyStyle(0,FWS_VISIBLE);
	ui::Manager::GetInstance()->EndPopupWnd();
	EditMap *pMap = CommDB::GetInstance()->GetMap();
	pMap->SetSunLightAmbientColor(m_dwOldAmbientColor);
	pMap->SetSunLightDiffuseColor(m_dwOldDirectionalColor);
}
Пример #2
0
void WndLightAdjust::Update()
{
	//UPDATE DEFAULT
	ui::Wnd::UpdateDefault();
	
	ui::Manager::_tagINPUTINFO *pInputInfo = ui::Manager::GetInstance()->GetInputInfoBuffer();
	render::Interface *pInterface = render::Interface::GetInstance();

	DWORD &dwStyle = m_tWindowInfo.dwStyle;
	if (dwStyle & FWS_VISIBLE && !(dwStyle & FWS_DISABLE))
	{
		if (m_bPickColor)
		{
			if (pInputInfo->eType == UIMT_MS_BTNUP && pInputInfo->dwData == MK_LBUTTON)
			{
				m_bPickColor = FALSE;
			}
			else
			{
				//检查颜色
				DWORD px = (DWORD)pInputInfo->ptMouse.x;
				DWORD py = (DWORD)pInputInfo->ptMouse.y;
				if (px > m_dwPickX && py > m_dwPickY &&
					px < m_dwPickX + m_dwColorMapWidth && 
					py < m_dwPickX + m_dwColorMapHeight)
				{
					//计算位置
					int iPosX = px - m_dwPickX;
					int iPosY = py - m_dwPickY;
					//取得颜色
					render::Texture   * pTexture  = pInterface->GetTexture(m_dwColorMapHandle);
					DWORD dwColor = pTexture->GetPixel(iPosX,iPosY);
					if (m_ePickType == PICK_AMBIENT)
					{
						m_pBtnAmbient->SetColor(dwColor);
						EditMap *pMap = CommDB::GetInstance()->GetMap();
						pMap->SetSunLightAmbientColor(dwColor);
					}
					else
					{
						m_pBtnDirectional->SetColor(dwColor);
						EditMap *pMap = CommDB::GetInstance()->GetMap();
						pMap->SetSunLightDiffuseColor(dwColor);
					}
				}
			}
			
		}
		else
		{
			if (m_pBtnOK->IsClicked())
			{
				EndPopUp();
				m_bIsOK = TRUE;
				m_bIsPopupCheckFlag= TRUE;
			}
			if (m_pBtnCancel->IsClicked())
			{
				EndPopUp();
				m_bIsOK = FALSE;
				m_bIsPopupCheckFlag = TRUE;
			}
			if (m_pBtnAmbient->IsClicked())
			{
				m_ePickType = PICK_AMBIENT;
				m_bPickColor = TRUE;
			}
			if (m_pBtnDirectional->IsClicked())
			{
				m_ePickType = PICK_DIRECTIONAL;
				m_bPickColor = TRUE;
			}
			ui::Wnd::UpdateChild();
		}
		
	}
}