Example #1
0
void CUISkinSelectorWnd::SendMessage(CUIWindow *pWnd, s16 msg, void *pData)
{
	game_cl_mp	*game = NULL;
	//game_cl_Deathmatch * dm = NULL;
	switch (msg){
		case BUTTON_CLICKED:
			game = smart_cast<game_cl_mp*>(&(Game()));
			//dm = smart_cast<game_cl_Deathmatch *>(&(Game()));

			if (pWnd == m_pButtons[0])
				OnKeyLeft();
			else if (pWnd == m_pButtons[1])
				OnKeyRight();
			else if (pWnd == m_pBtnAutoSelect)
			{
				m_iActiveIndex = -1;
				OnBtnOK();		
			}
			else if (pWnd == m_pBtnSpectator)
			{
				Game().StartStopMenu(this,true);
				game->OnSpectatorSelect();
			}
			else if (pWnd == m_pBtnBack)
			{
				Game().StartStopMenu(this,true);
				game->OnSkinMenuBack();				
			}
			else
                for (int i = 0; i<4; i++)
					if (pWnd == m_pImage[i])
					{
						m_iActiveIndex = m_firstSkin+i;
						OnBtnOK();					
					}
			break;
		case STATIC_FOCUS_RECEIVED:
			if (pWnd == m_pButtons[0])
			{
				m_pAnims[0]->Rewind(0);
				m_pAnims[0]->Play();
			}
			else if (pWnd == m_pButtons[1])
			{
				m_pAnims[1]->Rewind(0);
				m_pAnims[1]->Play();
			}
			
			break;
	}
}
Example #2
0
	void CModifiedButtonWidget::OnKeyboardEvent( CKeyboardEvent* event )
	{
		if( event->GetType() == types::key_down )
		{
			switch( event->GetKey() )
			{
				case types::keys::_return:
					OnClick( myParam );
					break;
					
				case types::keys::_tab:
					OnKeyTab();
					break;
					
				case types::keys::_up:
					OnKeyUp();
					break;
					
				case types::keys::_down:
					OnKeyDown();
					break;
					
				case types::keys::_left:
					OnKeyLeft();
					break;
					
				case types::keys::_right:
					OnKeyRight();
					break;
					
				case types::keys::_escape:
					OnKeyEsc();
					break;
					
				default:
					break;
			}
		}
	}
Example #3
0
bool CUISkinSelectorWnd::OnKeyboard(int dik, EUIMessages keyboard_action)
{
	if (WINDOW_KEY_PRESSED != keyboard_action)
	{
		if (dik == DIK_TAB)
		{
			ShowChildren(true);
			game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
			game->OnKeyboardRelease(kSCORES);
			UI()->GetUICursor()->Show();
		}
		
		return false;
	}

	if (dik == DIK_TAB)
	{
        ShowChildren(false);
		game_cl_mp* game = smart_cast<game_cl_mp*>(&Game());
		game->OnKeyboardPress(kSCORES);
		UI()->GetUICursor()->Hide();
		return false;
	}

	int right_border = (int)m_skins.size();
	if (right_border > 9)
		right_border = 9;

	if (dik >= DIK_1 && dik < (int)right_border + DIK_1)
	{
		int NewIndex = dik - DIK_1;
//		Msg("Selected %d", NewIndex);
//		for (u32 i=0; i<m_skinsEnabled.size(); i++)
//			Msg("Enabled - %d", m_skinsEnabled[i]);
		xr_vector<int>::iterator It = std::find(m_skinsEnabled.begin(), m_skinsEnabled.end(), NewIndex);
		if (It != m_skinsEnabled.end())
		{
			m_iActiveIndex = NewIndex;
			OnBtnOK();			
		}
		return true;		
	}

//	game_cl_Deathmatch * dm = smart_cast<game_cl_Deathmatch *>(&(Game()));

	switch (dik){
		case DIK_ESCAPE:
//			Game().StartStopMenu(this,true);
//			dm->OnSkinMenuBack();
			OnBtnCancel();
			return true;
		case DIK_SPACE: // do autoselect
			m_iActiveIndex = -1;
		case DIK_RETURN:	
			OnBtnOK();
			return true;
		case DIK_LEFT:
			OnKeyLeft();
			return true;
		case DIK_RIGHT:
			OnKeyRight();
			return true;
	}

	return false;
}
Example #4
0
void CTextInputWidget::OnKeyboardEvent( CKeyboardEvent* event )
{
	if( event->GetType() == types::key_down )
	{
		switch( event->GetKey() )
		{
		case types::keys::_backspace:
			OnKeyBackspace();
			break;

		case types::keys::_return:
			OnKeyEnter();
			break;

		case types::keys::_tab:
			OnKeyTab();
			break;

		case types::keys::_up:
			OnKeyUp();
			break;

		case types::keys::_down:
			OnKeyDown();
			break;

		case types::keys::_left:
			OnKeyLeft();
			break;

		case types::keys::_right:
			OnKeyRight();
			break;

		case types::keys::_delete:
			OnKeyDelete();
			break;

		case types::keys::_home:
			OnKeyHome();
			break;

		case types::keys::_end:
			OnKeyEnd();
			break;
		case types::keys::_escape:
			OnKeyEsc();
			break;

		default:
			{
				if( IsValidKey( event->GetAsCharacter() ) )
				{
					AddCharacter( event->GetAsCharacter() );
				}
			}
			break;
		}

	}
}