Exemple #1
0
void Pointer::setFocus(Surface *surface, const QPointF &position)
{
    if (m_focusResource && m_focus != surface) {
        uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
        send_leave(m_focusResource->handle, serial, m_focus->resource()->handle);
        wl_list_remove(&m_focusDestroyListener.listener.link);
        wl_list_init(&m_focusDestroyListener.listener.link);
    }

    Resource *resource = surface ? resourceMap().value(surface->resource()->client()) : 0;

    if (resource && (m_focus != surface || resource != m_focusResource)) {
        uint32_t serial = wl_display_next_serial(m_compositor->wl_display());
        Keyboard *keyboard = m_seat->keyboardDevice();
        if (keyboard) {
            wl_keyboard::Resource *kr = keyboard->resourceMap().value(surface->resource()->client());
            if (kr)
                keyboard->sendKeyModifiers(kr, serial);
        }
        send_enter(resource->handle, serial, surface->resource()->handle,
                   wl_fixed_from_double(position.x()), wl_fixed_from_double(position.y()));

        wl_signal_add(&surface->resource()->handle->destroy_signal, &m_focusDestroyListener.listener);
    }

    m_focusResource = resource;
    m_focus = surface;
}
Exemple #2
0
void DisplayStateConfiguration( const Keyboard & keyboard )
{
  char orthogonalRegion = 'a';

  for ( Keyboard::state_iterator pLeafState = keyboard.state_begin();
    pLeafState != keyboard.state_end(); ++pLeafState )
  {
    std::cout << "Orthogonal region " << orthogonalRegion << ": ";

    const Keyboard::state_base_type * pState = &*pLeafState;

    while ( pState != 0 )
    {
      if ( pState != &*pLeafState )
      {
        std::cout << " -> ";
      }

      #ifdef BOOST_STATECHART_USE_NATIVE_RTTI
      std::cout << std::setw( 15 ) << typeid( *pState ).name();
      #else
      std::cout << std::setw( 15 ) <<
        pState->custom_dynamic_type_ptr< char >();
      #endif
      pState = pState->outer_state_ptr();
    }

    std::cout << "\n";
    ++orthogonalRegion;
  }

  std::cout << "\n";
}
Exemple #3
0
/*----------------------------------------------------------------------------------------------*/
void *Keyboard_Thread(void *_arg)
{

	Keyboard *aKeyboard = pKeyboard;
	int32 key;

	while(grun)
	{
		key = getchar();

		fprintf(stderr,"%c\n",(char)key);

		if((char)key == 'Q')
		{
			grun = 0x0;
		}

		usleep(1000);

		aKeyboard->IncExecTic();
	}

	pthread_exit(0);

}
	virtual void onKeyDown(const Keyboard& k)
	{
		/* Recalling existing presets will show the changes in the html GUI */
		if (k.isNumber()) { // Recall preset
			presetHandler.recallPreset(k.keyAsNumber());
		}
	}
Exemple #5
0
void main(){
	Keyboard k;
	clrscr();
	int key = k.GetKeyCode();
	switch(key){
		case ARROW_UP:
			cout<<"Up Arrow key";
			break;
		case ARROW_DOWN:
			cout<<"Down Arrow key";
			break;
		case ARROW_LEFT:
			cout<<"Left Arrow key";
			break;
		case ARROW_RIGHT:
			cout<<"Right Arrow key";
			break;
		case ALT_F4:
			cout<<"Alt + F4";
			break;
		default:
			cout<<"Code: "<<key<<"\nNot Arrow key";
			break;
	}
	if(k.IsSpecialKey())
		cout<<"\nSpecial Key!";
	else
		cout<<"\nNot a special key!";
	getch();
}
Exemple #6
0
//-----------------------------------------------------------------------------------------------
void DeveloperConsole::CheckForLogHistoryMovement( const Keyboard& keyboard )
{
	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_UP_ARROW ) )
	{
		if( m_consoleTextEntryPosition > 0 )
		{
			--m_consoleTextEntryPosition;
			m_commandPromptLine = m_consoleLogHistoryLines[ m_consoleTextEntryPosition ];
			m_cursorPosition = m_commandPromptLine.m_text.size();
		}
	}

	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_DOWN_ARROW ) )
	{
		if( m_consoleTextEntryPosition < m_consoleLogHistoryLines.size() )
		{
			++m_consoleTextEntryPosition;

			if( m_consoleTextEntryPosition == m_consoleLogHistoryLines.size() )
			{
				m_commandPromptLine.m_text = "";
				m_cursorPosition = 0;
			}
			else
			{
				m_commandPromptLine = m_consoleLogHistoryLines[ m_consoleTextEntryPosition ];
				m_cursorPosition = m_commandPromptLine.m_text.size();
			}
		}
	}
}
		void InputProcessor::Enable(bool enable)
		{
			if (IsEnabled() == enable)
				return;

			Keyboard *keyboard = m_gameApp->GetKeyboard();
			Mouse *mouse = m_gameApp->GetMouse();
			Touchscreen *touchscreen = m_gameApp->GetTouchscreen();

			if (enable)
			{
				if (keyboard != NULL)
					keyboard->RegisterListener(this);
				if (mouse != NULL)
					mouse->RegisterListener(this);
				if (touchscreen != NULL)
					touchscreen->RegisterListener(this);
			}
			else
			{
				if (keyboard != NULL)
					keyboard->UnregisterListener(this);
				if (mouse != NULL)
					mouse->UnregisterListener(this);
				if (touchscreen != NULL)
					touchscreen->UnregisterListener(this);
			}

			m_enabled = enable;
		}
bool Application::OnUpdate()
{
	//System Update
	m_pMouse->Update();
	m_pKeyboard->Update();
	m_pCamera->Update();
	m_pGameTime->Update();

	//m_fRot += PI * GameTime::GetTimeElapsed();
	//m_pScene->SetRotateY(m_fRot);

	m_pScene->Update();

	if(m_pKeyboard->IsKeyPressed(KEY_1))
	{
		m_pParent->DetachChild(m_pChild);
	}
	else if(m_pKeyboard->IsKeyPressed(KEY_2))
	{
		m_pParent->AttachChild(m_pChild);
	}

	m_pChild->Update();

	DX11Camera::FreeLookCamera(m_pCamera,10.0f);
	//m_pCamera->LookAt(D3DXVECTOR3(0,0,0));

	

	//Window Update
	return m_pWindow->Tick();
}
void guessWords(Password* fh)
{
   Keyboard* kb = Keyboard::getKeyboard();
   int numLeft = fh->getNumberOfPasswordsLeft();
   while (numLeft > 1)  //terminate if the password has been identified, or there is no valid password (user entry error)
   {
      int best_guess_index = fh->bestGuess();

      String* best_guess_word = fh->getOriginalWord(best_guess_index);
      cout << "You should guess \"";
      best_guess_word->displayString();
      cout << "\" at index " << best_guess_index;
      cout << endl << endl;

      String* guess_str = kb->readString("Index of word in the original word list to guess (1-based): ");
      int guess = guess_str->a_to_i();
      delete guess_str;

      String* match_str = kb->readString("Number of character matches: ");
      int match = match_str->a_to_i();
      delete match_str;
      cout << endl;

      fh->guess(guess, match);  //1-based index of the guessed word and the number of character matches
      fh->displayViableWords();

      numLeft = fh->getNumberOfPasswordsLeft();
   }
}
Exemple #10
0
		void sendkey(int32_t keycode, bool pressed)
		{
			if (focusedtextfield)
			{
				Keyboard::Keymapping mapping = keyboard.gettextmapping(keycode);

				switch (mapping.type)
				{
				case Keyboard::KT_ACTION:
					focusedtextfield->sendkey(Keyboard::KT_ACTION, mapping.action, pressed);
					break;
				case Keyboard::KT_LETTER:
					if (!pressed)
					{
						int8_t letter;
						if (keydown[keyboard.getshiftkeycode()])
							letter = static_cast<int8_t>(mapping.action);
						else
							letter = static_cast<int8_t>(mapping.action + 32);

						focusedtextfield->sendkey(Keyboard::KT_LETTER, letter, pressed);
					}
					break;
				case Keyboard::KT_NUMBER:
					focusedtextfield->sendkey(Keyboard::KT_NUMBER, mapping.action, pressed);
					break;
				}
			}
			else if (gamekeysenabled)
			{
				const Keyboard::Keymapping* mapping = keyboard.getmapping(keycode);

				if (!mapping)
					return;

				Keyboard::Keytype type = mapping->type;
				int32_t action = mapping->action;

				switch (type)
				{
				case Keyboard::KT_MENU:
					if (pressed)
					{
						addelementbykey(action);
					}
					break;
				case Keyboard::KT_ACTION:
				case Keyboard::KT_FACE:
				case Keyboard::KT_ITEM:
				case Keyboard::KT_SKILL:
					Gameplay::Stage::sendkey(type, action, pressed);
					break;
				}
			}

			keydown[keycode] = pressed;
		}
Exemple #11
0
void InputManager::setWindow(Window* window)
{
	this->window = window;

	if( window == nullptr )
	{
		Keyboard* keyboard = GetInputManager()->getKeyboard();
		if(keyboard) keyboard->resetKeys();
	}
}
Exemple #12
0
	virtual bool onKeyUp(const Keyboard &k) {
        if (k.ctrl() || k.alt() || k.meta()) {
			return true;
		}
//		if (!mApp->mPresetKeyboardActive) {
//			return true;
//		}
		switch(k.key()){
		case '1': mApp->release(0); return false;
		case '2': mApp->release(1); return false;
		case '3': mApp->release(2); return false;
		case '4': mApp->release(3); return false;
		case '5': mApp->release(4); return false;
		case '6': mApp->release(5); return false;
		case '7': mApp->release(6); return false;
		case '8': mApp->release(7); return false;
		case '9': mApp->release(8); return false;
		case '0': mApp->release(9); return false;
		case 'q': mApp->release(10); return false;
		case 'w': mApp->release(11); return false;
		case 'e': mApp->release(12); return false;
		case 'r': mApp->release(13); return false;
		case 't': mApp->release(14); return false;
		case 'y': mApp->release(15); return false;
		case 'u': mApp->release(16); return false;
		case 'i': mApp->release(17); return false;
		case 'o': mApp->release(18); return false;
		case 'p': mApp->release(19); return false;
		case 'a': mApp->release(20); return false;
		case 's': mApp->release(21); return false;
		case 'd': mApp->release(22); return false;
		case 'f': mApp->release(23); return false;
		case 'g': mApp->release(24); return false;
		case 'h': mApp->release(25); return false;
		case 'j': mApp->release(26); return false;
		case 'k': mApp->release(27); return false;
		case 'l': mApp->release(28); return false;
		case ';': mApp->release(29); return false;
		case 'z': mApp->release(30); return false;
		case 'x': mApp->release(31); return false;
		case 'c': mApp->release(32); return false;
		case 'v': mApp->release(33); return false;
		case 'b': mApp->release(34); return false;
		case 'n': mApp->release(35); return false;
		case 'm': mApp->release(36); return false;
		case ',': mApp->release(37); return false;
		case '.': mApp->release(38); return false;
		case '/': mApp->release(39); return false;
		default: break;
		}
		return true;
	}
Exemple #13
0
void CALLBACK charPressed(wchar_t nChar, void* userContext)
{
	Keyboard *kb = Environment::instance()->getKeyboard(0);
	if (kb!=NULL)
	{
		int mods = getKeyMods();
		if (mods==Keyboard::KEYMOD_NONE && gLastKeyDown!=nChar)
		{
			kb->fireKeyDownEvent((wchar_t)nChar,Keyboard::KEY_UNKNOWN,(Keyboard::Modifiers)mods);
		}
	}
//	envDebugLog("charPressed: nChar=0x%x (%c)\n",nChar,nChar);
}
Exemple #14
0
Keyboard *Seat::createKeyboard(QObject *parent)
{
    Q_ASSERT(isValid());
    Q_ASSERT(d->capabilityKeyboard);
    Keyboard *k = new Keyboard(parent);
    connect(this, &Seat::interfaceAboutToBeReleased, k, &Keyboard::release);
    connect(this, &Seat::interfaceAboutToBeDestroyed, k, &Keyboard::destroy);
    auto w = wl_seat_get_keyboard(d->seat);
    if (d->queue) {
        d->queue->addProxy(w);
    }
    k->setup(w);
    return k;
}
void Player::handleInput(Keyboard input)
{
    if (input.isDown(SDLK_w) && input.isDown(SDLK_s)) {
        this->mov_stop();
    } else
    if (input.isDown(SDLK_w)) {
        this->mov_forward();
    } else
    if (input.isDown(SDLK_s)) {
        this->mov_backward();
    } else {
        this->mov_stop();
    }

    if (input.isDown(SDLK_a) && input.isDown(SDLK_d)) {
        this->rot_stop();
    } else
    if (input.isDown(SDLK_a)) {
        this->rot_left();
    } else
    if (input.isDown(SDLK_d)) {
        this->rot_right();
    } else {
        this->rot_stop();
    }
}
Exemple #16
0
VOID Simulator::run(VOID *arg)
{
   LOG_ENTERFN();

   m_pScn = Scenario::getInstance();
   m_pScn->init(Config::getInstance()->getScnFile());

   // Initialing the Display task to display session statistics on terminal
   Display *pDisp = Display::getInstance();
   pDisp->init();

   /* Creates UDP sockets for listing of gtp messages */
   LOG_DEBUG("Initializing Transport connections");
   if (ROK != initTransport())
   {
      LOG_FATAL("Initializing Transport connections");
      LOG_EXITVOID();
   }

   // Initialing the Keyboard to process user inputs
   Keyboard *pKb = Keyboard::getInstance();
   pKb->init();

   if (SCN_TYPE_INITIATING == m_pScn->getScnType())
   {
      TrafficTask *pTTask = new TrafficTask;
      if (pTTask == NULL)
      {
         LOG_ERROR("Traffic Task Init");
      }

      /* peer information is maintianed to managing sequence numbers
       * and ordering of message
       */
      IPEndPoint peer;
      peer.ipAddr = Config::getInstance()->getRemoteIpAddr();
      peer.port = Config::getInstance()->getRemoteGtpcPort();
      addPeerData(peer);
   }

   LOG_DEBUG("Generating Signalling traffic");
   startScheduler();

   pKb->abort();
   TaskMgr::deleteAllTasks();
   deletePeerTable();

   LOG_EXITVOID();
}
//----------------------------------------
//construction de la scène
void display()
{
	
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
	glLoadIdentity(); 
	gluLookAt(world.viewer.mypositionX,world.viewer.mypositionY,world.viewer.mypositionZ,
			  world.viewer.mypositionX + world.viewer.objectX,world.viewer.mypositionY + world.viewer.objectY,world.viewer.mypositionZ + world.viewer.objectZ,
			  0.0,1.0,0.0);  //point de vue

	keyboard.keyboardmovement(world);
	drawskybox();
	world.viewerMovement();
	world.viewerchoose();

	//3d scène
	world.afficheworld();

	//2d GUI
	drawGUI(width, height, page, choice);

	// Render your 2D text
	//glColor3f(0.0f, 0.0f, 0.0f); 
	//glRasterPos2f(0,2); 
	//fond.glPrint("rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr"); 

	//cout << world.viewer.objectX << " " << world.viewer.objectY << " " << world.viewer.objectZ << endl;
	//cout << world.viewer.objectX * world.viewer.objectX + world.viewer.objectZ * world.viewer.objectZ << endl;
	glutSwapBuffers(); 
}
Exemple #18
0
	virtual bool onKeyDown(const Keyboard& k){
		switch(k.key()){
		case 'f': wireframe^=1; return false;
		case ' ': evolve^=1; return false;
		}
		return true;
	}
void PostPlayScreen::Update(float DeltaTime)
{
	Controller*	tC	=	InputManager::GetInstance()->GetController(0);
	Keyboard*	tK	=	InputManager::GetInstance()->GetKeyboard();

	bool	UP		=	tC->GetButtonState( D_UP ) == PRESSED		|| tK->GetKeyState( VK_UP ) == PRESSED		|| tK->GetKeyState( 'W' ) == PRESSED;
	bool	DOWN	=	tC->GetButtonState( D_DOWN ) == PRESSED		|| tK->GetKeyState( VK_DOWN ) == PRESSED	|| tK->GetKeyState( 'S' ) == PRESSED;
	bool	CONFIRM	=	tC->GetButtonState( A ) == PRESSED			|| tK->GetKeyState( VK_RETURN ) == PRESSED;
	bool	BACK	=	tC->GetButtonState( B ) == PRESSED			|| tK->GetKeyState( VK_ESCAPE ) == PRESSED;

	if( CONFIRM )
	{
		gGotoNextFrame	=	MAIN_MENU_SCREEN;
		gScreenData->PLAYER_SCORE_LIST.clear();
	}
}
Exemple #20
0
void System::restart(int Type) /*the different types of restarts*/
{
    _atexit();

    disable();					/* disable interrupts */

    keyboard.FlushBuffer();		/* clear keyboard buffer */

    switch (Type)				/* 0 shutdown, 1 Cold boot, Other Warm boot */
    {
    case 1:
        keyboard.SendCommand(0xFE);
    }

    halt();						/* Halt the cpu */
}
Exemple #21
0
//-----------------------------------------------------------------------------------------------
void DeveloperConsole::CheckForCommandExecute( const Keyboard& keyboard )
{
	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_ENTER ) )
	{
		if( m_commandPromptLine.m_text.size() > 0 )
		{
			if( m_consoleLogHistoryLines.size() == 0 )
				m_consoleLogHistoryLines.push_back( m_commandPromptLine );
			else if( m_consoleLogHistoryLines.size() > 0 && m_commandPromptLine.m_text != m_consoleLogHistoryLines.back().m_text )
				m_consoleLogHistoryLines.push_back( m_commandPromptLine );

			while( m_commandPromptLine.m_text.size() > 0 && m_commandPromptLine.m_text[ 0 ] == ' ' )
				m_commandPromptLine.m_text.erase( 0, 1 );

			int firstSpacePos = m_commandPromptLine.m_text.find( ' ' );
			if( firstSpacePos == -1 )
				ExecuteConsoleCommand( m_commandPromptLine.m_text, "" );
			else
				ExecuteConsoleCommand( m_commandPromptLine.m_text.substr( 0, firstSpacePos ), m_commandPromptLine.m_text.substr( firstSpacePos + 1 ) );

			m_commandPromptLine.m_text = "";
			m_cursorPosition = 0;
			m_consoleTextEntryPosition = m_consoleLogHistoryLines.size();
		}
	}
}
Exemple #22
0
void AddSynthApp::onKeyUp(const Keyboard &k)
{
    if (!mPresetKeyboardActive) {
        return;
    }
    release(k.key());
}
Exemple #23
0
void AddSynthApp::onKeyDown(const Keyboard &k)
{
    if (!mPresetKeyboardActive) {
        return;
    }
//    if (k.ctrl() || k.alt() || k.meta()) {
//        trigger(100);
//    }

    float frequency = 440;
    int keyOffset = (int) keyboardOffset.get();
    int id = k.key();
    switch(id){
    case '1': frequency = mtof(50 + keyOffset);break;
    case '2': frequency = mtof(51 + keyOffset);break;
    case '3': frequency = mtof(52 + keyOffset);break;
    case '4': frequency = mtof(53 + keyOffset);break;
    case '5': frequency = mtof(54 + keyOffset);break;
    case '6': frequency = mtof(55 + keyOffset);break;
    case '7': frequency = mtof(56 + keyOffset);break;
    case '8': frequency = mtof(57 + keyOffset);break;
    case '9': frequency = mtof(58 + keyOffset);break;
    case '0': frequency = mtof(59 + keyOffset);break;
    case 'q': frequency = mtof(60 + keyOffset);break;
    case 'w': frequency = mtof(61 + keyOffset);break;
    case 'e': frequency = mtof(62 + keyOffset);break;
    case 'r': frequency = mtof(63 + keyOffset);break;
    case 't': frequency = mtof(64 + keyOffset);break;
    case 'y': frequency = mtof(65 + keyOffset);break;
    case 'u': frequency = mtof(66 + keyOffset);break;
    case 'i': frequency = mtof(67 + keyOffset);break;
    case 'o': frequency = mtof(68 + keyOffset);break;
    case 'p': frequency = mtof(69 + keyOffset);break;
    case 'a': frequency = mtof(70 + keyOffset);break;
    case 's': frequency = mtof(71 + keyOffset);break;
    case 'd': frequency = mtof(72 + keyOffset);break;
    case 'f': frequency = mtof(73 + keyOffset);break;
    case 'g': frequency = mtof(74 + keyOffset);break;
    case 'h': frequency = mtof(75 + keyOffset);break;
    case 'j': frequency = mtof(76 + keyOffset);break;
    case 'k': frequency = mtof(77 + keyOffset);break;
    case 'l': frequency = mtof(78 + keyOffset);break;
    case ';': frequency = mtof(79 + keyOffset);break;
    case 'z': frequency = mtof(80 + keyOffset);break;
    case 'x': frequency = mtof(81 + keyOffset);break;
    case 'c': frequency = mtof(82 + keyOffset);break;
    case 'v': frequency = mtof(83 + keyOffset);break;
    case 'b': frequency = mtof(84 + keyOffset);break;
    case 'n': frequency = mtof(85 + keyOffset);break;
    case 'm': frequency = mtof(86 + keyOffset);break;
    case ',': frequency = mtof(87 + keyOffset);break;
    case '.': frequency = mtof(88 + keyOffset);break;
    case '/': frequency = mtof(89 + keyOffset);break;
    }

//    std::cout << id << ".." << frequency << std::endl;
    synth.mFundamental.set(frequency);
    trigger(id);
}
Exemple #24
0
		Keyboard *RegisterKeyboard(IO::Object *service)
		{
			Keyboard *keyboard = _keyboardMap->GetObjectForKey<Keyboard>(service);
			if(keyboard)
				return keyboard;

			size_t index = (_keyboardCounter ++);
			keyboard = Keyboard::Alloc()->Init(index);

			if(keyboard)
			{
				_keyboardMap->SetObjectForKey(keyboard, service);
				keyboard->Release();
			}

			return keyboard;
		}
	virtual void onKeyDown(const ViewpointWindow& w, const Keyboard& k){
		switch(k.key()){
			case ' ':
				nav().pos().print(); printf("\n");
				nav().quat().print(); printf("\n");
				break;
		}
	}
Exemple #26
0
	virtual bool onKeyDown(const Keyboard& k){
		switch(k.key()){
			case 'f': lens.fovy(lens.fovy()-5); break;
			case 'g': lens.fovy(lens.fovy()+5); break;
			default:;
		}
		return true;
	}
Exemple #27
0
//-----------------------------------------------------------------------------------------------
void DeveloperConsole::CheckForKeyPress( const Keyboard& keyboard )
{
	if( keyboard.IsKeyPressedDown( KEY_TILDE ) )
	{
		m_commandPromptLine.m_text = "";
		m_cursorPosition = 0;
		return;
	}

	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_ESCAPE ) )
	{
		if( m_commandPromptLine.m_text.size() > 0 )
		{
			m_commandPromptLine.m_text = "";
			m_cursorPosition = 0;
		}
		else
			m_drawConsole = false;

		return;
	}

	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_ENTER ) && m_commandPromptLine.m_text.size() == 0 )
	{
		m_drawConsole = false;
		return;
	}

	CheckForCharDelete( keyboard );
	CheckForCursorMovement( keyboard );
	CheckForLogHistoryMovement( keyboard );
	CheckForCommandExecute( keyboard );

	for( unsigned int charIndex = CHAR_VALUES_START; charIndex < NUM_KEYBOARD_CHARS; ++charIndex )
	{
		if( keyboard.IsCharPressedDown( (unsigned char) charIndex ) )
		{
			m_commandPromptLine.m_text.insert( m_cursorPosition, 1, (unsigned char) charIndex );
			m_drawCursor = true;
			m_secondsSinceCursorRenderToggle = 0.f;
			++m_cursorPosition;
			return;
		}
	}
}
Exemple #28
0
void CALLBACK keyPressed(UINT nChar, bool keyDown, bool altDown, void* userContext)
{
	WinEnvironment *env = dynamic_cast<WinEnvironment*>(Environment::instance());
	env->processVirtualMouseEvents(nChar,keyDown);

	gAltDown = altDown;
	gShiftDown = DXUTIsKeyDown(VK_SHIFT);
	gControlDown = DXUTIsKeyDown(VK_CONTROL);

	Keyboard *kb = Environment::instance()->getKeyboard(0);
	if (kb!=NULL)
	{
		int mods = getKeyMods();
		Keyboard::Key key = getKey(nChar);
		if (key!=Keyboard::KEY_UNKNOWN)
		{
			nChar = 0;
		}

		if (keyDown)
		{
			// if this is a modified key or if it has no unicode equivalent:
			bool haveMods = mods!=Keyboard::KEYMOD_NONE;
			bool noUnicode = (nChar==0);
			if (haveMods || noUnicode)
			{
				kb->fireKeyDownEvent(nChar,key,(Keyboard::Modifiers)mods);
				gLastKeyDown = nChar;
//				envDebugLog("keyPressed: nChar=0x%x (%c)\n",nChar,nChar);
			}
		}
		else
		{
			kb->fireKeyUpEvent(nChar, key, (Keyboard::Modifiers)mods);
		}
	}

#ifdef _DEBUG
	if (gControlDown && gAltDown && nChar=='D' && keyDown)
	{
		Environment *env = Environment::instance();
		env->setDebugEnabled(!env->isDebugEnabled());
	}
#endif
}
Exemple #29
0
//-----------------------------------------------------------------------------------------------
void DeveloperConsole::CheckForCharDelete( const Keyboard& keyboard )
{
	if( keyboard.IsKeyPressedDownAndWasNotBefore( KEY_BACK ) || keyboard.IsKeyPressedDownAndWasNotBefore( KEY_DELETE ) || keyboard.IsCharPressedDown( 0x08 ) )
	{
		if( m_commandPromptLine.m_text.size() > 0 )
		{
			if( m_cursorPosition == 0 )
				return;

			if( m_cursorPosition == m_commandPromptLine.m_text.size() )
				m_commandPromptLine.m_text.pop_back();
			else
				m_commandPromptLine.m_text.erase( m_cursorPosition - 1, 1 );

			--m_cursorPosition;
		}
	}
}
void LineEditWithRegExpAndKeyboard::mousePressEvent(QMouseEvent *)
{
	this->selectAll();
	Keyboard* keyboard = Keyboard::GetInstance();

	switch (m_keyboardShowMode)
	{
	case LineEditWithRegExpAndKeyboard::KEYBOARD_SHOW_TEXT:
	{
		keyboard->SetCurrentText(this->text());
	}break;
	default:
		break;
	}

	keyboard->SetKeyboardInterface(this);
	keyboard->show();
}