当前位置: 首页>>代码示例>>C++>>正文


C++ Keyboard类代码示例

本文整理汇总了C++中Keyboard的典型用法代码示例。如果您正苦于以下问题:C++ Keyboard类的具体用法?C++ Keyboard怎么用?C++ Keyboard使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Keyboard类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: wl_display_next_serial

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;
}
开发者ID:locusf,项目名称:qtwayland,代码行数:28,代码来源:qwlpointer.cpp

示例2: DisplayStateConfiguration

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";
}
开发者ID:0xDEC0DE8,项目名称:mcsema,代码行数:33,代码来源:Keyboard.cpp

示例3: while

/*----------------------------------------------------------------------------------------------*/
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);

}
开发者ID:Bonacieux,项目名称:gps-sdr,代码行数:26,代码来源:keyboard.cpp

示例4: onKeyDown

	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());
		}
	}
开发者ID:AlloSphere-Research-Group,项目名称:SequencerTutorial,代码行数:7,代码来源:07_html_interface.cpp

示例5: main

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();
}
开发者ID:HVish,项目名称:Game,代码行数:30,代码来源:KEYBOARD.CPP

示例6: CheckForLogHistoryMovement

//-----------------------------------------------------------------------------------------------
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();
			}
		}
	}
}
开发者ID:MrBowler,项目名称:SD6-A2,代码行数:32,代码来源:DeveloperConsole.cpp

示例7: Enable

		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;
		}
开发者ID:gered,项目名称:MyGameFramework,代码行数:30,代码来源:gwen_inputprocessor.cpp

示例8: if

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();
}
开发者ID:NathanChambers,项目名称:Labyrinth-Engine,代码行数:32,代码来源:main.cpp

示例9: guessWords

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();
   }
}
开发者ID:dbpowell42,项目名称:DSLab03,代码行数:29,代码来源:PasswordDriver.cpp

示例10: sendkey

		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;
		}
开发者ID:sonbk21,项目名称:JourneyClient,代码行数:57,代码来源:UI.cpp

示例11: onKeyUp

	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;
	}
开发者ID:mantaraya36,项目名称:Oro,代码行数:52,代码来源:add_synth.cpp

示例12: charPressed

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);
}
开发者ID:fzzr-,项目名称:2dboy,代码行数:13,代码来源:WinD3DInterface.cpp

示例13: Q_ASSERT

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;
}
开发者ID:KDE,项目名称:kwayland,代码行数:14,代码来源:seat.cpp

示例14: handleInput

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();
    }
}
开发者ID:ThomasvLingen,项目名称:SDL_raycaster_fun,代码行数:26,代码来源:player.cpp

示例15: LOG_ENTERFN

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();
}
开发者ID:2fumin,项目名称:LTE-GTP-Simulator,代码行数:49,代码来源:sim.cpp


注:本文中的Keyboard类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。