コード例 #1
0
void SpectralEffect::BryoKeyDown()
{
	if (GetKeyEvent(DIK_A))
		testcannons.LoadCannon(0);
	if (GetKeyEvent(DIK_S))
		testcannons.LoadCannon(1);
	if (GetKeyEvent(DIK_D))
		testcannons.LoadCannon(2);
}
コード例 #2
0
HRESULT proxIDirect3DDevice9::Present(CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion)
{ 
	::PollKeys( );
	
	if ( GetKeyEvent( KEY_F4 ) == KEYEVENT_PRESSED ) {
		::SubmitChat( L"Hello World!" );
	}

	// not very descriptive names, but im in a rush
	bool b = false;
	float3 p( 0.f, 0.f, 0.f );

	// honestly should just make this constant-time access
	if ( GetKeyEvent( KEY_F1 ) == KEYEVENT_PRESSED ) {
		b = true;
		p = float3( -3.25f, 0.f, 0.f );
		::SubmitChat( L"going near red flag" );
	} else if ( GetKeyEvent( KEY_F2 ) == KEYEVENT_PRESSED ) {
		b = true;
		p = float3( 0.f, 0.f, 0.f );
		::SubmitChat( L"going to middle" );
	} else if ( GetKeyEvent( KEY_F3 ) == KEYEVENT_PRESSED ) {
		b = true;
		p = float3( 3.25f, 0.f, 0.f );
		::SubmitChat( L"going near blue flag" );
	}

	if ( b ) {
		::SetObjective( p );

		wchar_t buf[0x100];
		wprintf( buf, "%1.1f,%1.1f,%1.1f", p[0], p[1], p[2] );
		::SubmitChat( buf );
	}

	switch ( ::UpdateRunner( ) ) {
	case RUNUPDATE_REACHED:
		::SubmitChat( L"I have reached the destination." );
		break;
	}

    // call original routine
	HRESULT hres = lpIDirect3DDevice9->Present( pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion);

	return (hres);
}
コード例 #3
0
ファイル: mouse.c プロジェクト: frost242/demoscene
static BOOL HandleEvent() {
  MouseEventT cursor;
  KeyEventT key;

  if (GetKeyEvent(&key)) {
    if (!(key.modifier & MOD_PRESSED) && (key.code == KEY_ESCAPE))
      return FALSE;
  }

  if (GetMouseEvent(&cursor)) {
    UBYTE *data = screen->planes[0] + 
      cursor.x / 8 + cursor.y * screen->bytesPerRow;
    UBYTE value = 1 << (7 - (cursor.x & 7));

    if (cursor.button & LMB_PRESSED)
      *data |= value;
    if (cursor.button & RMB_PRESSED)
      *data &= ~value;

    UpdateSpritePos(pointer, X(cursor.x), Y(cursor.y));
  }

  return TRUE;
}
コード例 #4
0
bool RalEventGet(pmsg outMsg, ruint32 inTimeoutMs)
{
	int ret;
	KeyEventType key;
	int nKeyMsgType, nKeyCode, nKeyStatus;

	
	// Get Key Event From Device Driver
	while(1)
	{
		ret = GetKeyEvent(&key);	
		if( ret > 0 )
		{
			int validKey;
			
			if ( key.keyStatus == AWM_TIMER )
			{
				UsrHandleKernelTimerMessage();
				outMsg->wmsg = AWM_NONE;
				return TRUE;
			}
			if( key.keyStatus <= KEYREPEAT )
			{
				nKeyMsgType = key.keyStatus + AWM_KEYDOWN;
			}
			else
			{
				continue;
			}		
			
			nKeyCode = key.keyCode;		
			nKeyStatus = key.keyStatus;
			outMsg->wmsg = nKeyMsgType;			
			switch( nKeyCode )
			{
			case 0: outMsg->wparam = VK_PAD_0; validKey = 1; break;
			case 1: outMsg->wparam = VK_PAD_1; validKey = 1; break;
			case 2: outMsg->wparam = VK_PAD_2; validKey = 1; break;
			case 3: outMsg->wparam = VK_PAD_3; validKey = 1; break;
			case 4: outMsg->wparam = VK_PAD_4; validKey = 1; break;
			case 5: outMsg->wparam = VK_PAD_5; validKey = 1; break;
			case 6: outMsg->wparam = VK_USER_OK; validKey = 1; break;
			case 7: outMsg->wparam = VK_USER_CLR; validKey = 1; break;
			case 8: outMsg->wparam = VK_USER_UP; validKey = 1; break;
			case 9: outMsg->wparam = VK_USER_DOWN; validKey = 1; break;
			case 10: outMsg->wparam = VK_USER_LEFT; validKey = 1; break;
			case 11: outMsg->wparam = VK_USER_RIGHT; validKey = 1; break;
			default: outMsg->wparam = nKeyCode+'0';	validKey = 0; break;
			}
			outMsg->lparam = 0;
			//CONSOL_Printf("key wmsg:%d, wparam:%d\n", nKeyMsgType,nKeyCode); 
			//CONSOL_Printf("RalEventGet nKeyCode:%d, validKey:%d\n", nKeyCode, validKey);
			if ( validKey ) return TRUE;
		}
		/*
		if ( !MsgIsQueueEmpty() )
		{
			outMsg->wmsg = AWM_NONE;
			return TRUE;
		}
		*/
	}
}