Exemple #1
0
Input::InputMode Input::toggleInputMode()
{
	if (mCurrentInputMode == IM_GUI) {
		setInputMode(IM_MOVEMENT);
		return IM_MOVEMENT;
	} else {
		setInputMode(IM_GUI);
		return IM_GUI;
	}
}
medLoadLUTDialog::medLoadLUTDialog(const QStringList & titles, QWidget *parent) :
    QInputDialog(parent)
{
    setModal(Qt::WindowModal);
    setInputMode(QInputDialog::TextInput);
    setLabelText(tr("Choose a transfert Function:"));
    setComboBoxItems(titles);;
    setOkButtonText(tr("Choose"));
}
//------------------------------------------------------------------------------
void GameLogicClientSoccer::onTeamAssignmentChanged(Player * player)
{
    if (player == puppet_master_->getLocalPlayer())
    {
        TEAM_ID team_id = score_.getTeamId(puppet_master_->getLocalPlayer()->getId());

        // also update mine warning billboards
        TankMineVisual::setLocalPlayerTeam(team_id);
        
        if (team_id != INVALID_TEAM_ID)
        {
        } else
        {
            setInputMode(IM_CONTROL_CAMERA);
        }
    }



    Team * team = score_.getTeam(player->getId());

    if (player == puppet_master_->getLocalPlayer())
    {
        if (team == NULL)
        {
            puppet_master_->getHud()->addMessage("You have been assigned to no team.");

            // Hide respawn counter
            show_respawn_text_ = false;
            handleRespawnCounter(0.0f);
        } else
        {
            show_respawn_text_ = true;
            puppet_master_->getHud()->addMessage(std::string("You have been assigned to ") +
                                                 team->getName() +
                                                 ".",
                                                 team->getColor());

            sendRespawnRequest(0);
        }
    } else if (puppet_master_->getLocalPlayer()->isLevelDataSet())
    {
        // Notification if other player changes team
        if (team)
        {
            puppet_master_->getHud()->addMessage(player->getName()   +
                                                 " has been assigned to " +
                                                 team->getName() +
                                                 ".",
                                                 team->getColor());
        } else
        {
            puppet_master_->getHud()->addMessage(player->getName() + " has been assigned to no team.");
        }
    }    
}
Exemple #4
0
	void GetPassword (const QString& key, const QString& diaText,
			const ICoreProxy_ptr& proxy,
			const EitherCont<void (), void (QString)>& cont,
			QObject *depender,
			bool useStored)
	{
		if (useStored)
		{
			const auto& result = GetPasswordHelper (key.toUtf8 (), proxy);
			if (!result.isNull ())
			{
				cont.Right (result);
				return;
			}
		}

		const auto dialog = new QInputDialog;
		dialog->setInputMode (QInputDialog::TextInput);
		dialog->setWindowTitle ("LeechCraft");
		dialog->setLabelText (diaText);
		dialog->setTextEchoMode (QLineEdit::Password);
		dialog->setAttribute (Qt::WA_DeleteOnClose);

		if (depender)
			QObject::connect (depender,
					SIGNAL (destroyed ()),
					dialog,
					SLOT (deleteLater ()));

		new Util::SlotClosure<Util::DeleteLaterPolicy>
		{
			[dialog, cont]
			{
				const auto& value = dialog->textValue ();
				if (value.isEmpty ())
					cont.Left ();
				else
					cont.Right (value);
			},
			dialog,
			SIGNAL (accepted ()),
			dialog
		};

		new Util::SlotClosure<Util::DeleteLaterPolicy>
		{
			[cont] { cont.Left (); },
			dialog,
			SIGNAL (rejected ()),
			dialog
		};

		dialog->show ();
	}
bool CaptureThread::readVideo(QString fn)
{
    bool res = false;
    setInputMode(INPUT_VIDEO);
    capMutex.lock();
    if (cap.isOpened())
        cap.release();
        res = cap.open(fn.toStdString());
    capMutex.unlock();

    return res;
}
bool CaptureThread::connectToCamera(int c)
{
    bool res = false;
    setInputMode(INPUT_CAMERA);
    capMutex.lock();
    if (cap.isOpened())
        cap.release();
        res = cap.open(c);
    capMutex.unlock();

    return res;
}
NativeEditBox::NativeEditBox(int x, int y, int width, int height, int maxSize, int options, Widget *parent,
	const String& initialText, const WString& titleString, bool fresh) :
	EditBox(x, y, width, height, parent),
mTitleString(titleString),
mString(NULL),
mOptions(options), x(x), y(y), width(width), height(height), fresh(fresh)
{
	setFont(Util::getFontWhite());
	setMaxSize(maxSize);
	setCaption(initialText);
	Environment::getEnvironment().addPointerListener(this);
#if defined(MA_PROF_QWERTY)
	setInputMode(EditBox::IM_QWERTY);
#endif
}
Exemple #8
0
//평수
void EstimateUserInfo::setSizeInputBox()
{
    auto editbox = EditBox::create(Size(300, 30), ui::Scale9Sprite::create());
    editbox->setPosition(ratioPosition(50, 52.5f));
    editbox->setPlaceHolder("공사할 공간의 면적(평수)");
    editbox->setMaxLength(100);
    editbox->setPlaceholderFontColor(Color3B::GRAY);
    editbox->setFontColor(Color3B::BLACK);
    editbox->setPlaceholderFontSize(10);
    editbox->setReturnType(EditBox::KeyboardReturnType::DONE);
    editbox->setInputMode(EditBox::InputMode::NUMERIC);

    this->addChild(editbox);
    editbox->setDelegate(this);
    
}
Exemple #9
0
void UI::initEditBox(){
    auto visibleSize=Director::getInstance()->getVisibleSize();
    auto eb=EditBox::create(cocos2d::Size(800,200) ,"editBG.png");
    eb->setPlaceHolder("请输入内容");
    eb->setPlaceholderFont("font/Marker Felt.ttf", 40);
    eb->setPlaceholderFontColor(Color3B::YELLOW);
    eb->setFont("font/Marker Felt.ttf", 20);
    eb->setColor(Color3B::BLACK);
    //eb->setInputFlag(cocos2d::ui::EditBox::InputFlag::PASSWORD);
    eb->setInputMode(cocos2d::ui::EditBox::InputMode::ANY);
    eb->setReturnType(cocos2d::ui::EditBox::KeyboardReturnType::DONE);
    //设置代理
    eb->setDelegate(this);
    eb->setMaxLength(20);
    eb->setPosition(visibleSize/2);
    addChild(eb);
    
}
void HelloWorld::testEditBox()
{
    auto sp = Scale9Sprite::create("textField.png");
    //设置大小
    sp->setPreferredSize(Size(255, 40));
    sp->setAnchorPoint(Point(0.5, 0.5));
    
    
    auto editBox=EditBox::create(Size(255, 40), sp);
    editBox->setPlaceHolder("请输入内容");
    editBox->setFontColor(Color3B(255, 0, 255));
    editBox->setPosition(Point(240, 60));
    editBox->setInputMode(EditBox::InputMode::ANY);
    editBox->setMaxLength(10);
    editBox->setReturnType(EditBox::KeyboardReturnType::DONE);
    editBox->setDelegate(this);
    editBox->setInputFlag(EditBox::InputFlag::PASSWORD);
    this->addChild(editBox);
}
Exemple #11
0
GraphicEngine::GraphicEngine()
{
	callbackArg = nullptr;
	call = nullptr;
	window = nullptr;
	_textEnteredcallback = nullptr;
	_usableKeyPressedCallback = nullptr;
	_timer = std::make_unique<Timer>();
	_timer->start();
	setInputMode(ZQSD);

	shotTypeToSpriteString[0] = "r-typesheet1.gif";
	shotTypeToSpriteString[1] = "r-typesheet1.gif";
	shotTypeToSpriteString[2] = "r-typesheet1.gif";
	shotTypeToSpriteString[3] = "r-typesheet1.gif";
	shotTypeToSpriteString[4] = "r-typesheet1.gif";


	DEBUG_MSG("GraphicEngine created");

}
Exemple #12
0
			// convenience methods
			inline static void
			setSingleEndedInput(adc::PositiveInput input)
			{
				setInputMode(adc::INPUTMODE_SINGLEENDED);
				setPositiveInput(input);
			}
Exemple #13
0
			inline static void
			setNegativeInput(adc::NegativeInputWithGain input)
			{
				setInputMode(adc::INPUTMODE_DIFFERENTIAL_WITH_GAIN);
				ADCB_CH0_MUXCTRL = (ADCB_CH0_MUXCTRL & ~ADC_CH_MUXNEG_gm) | input;
			}
Exemple #14
0
			inline static void
			setInternalInput(adc::InternalInput input)
			{
				setInputMode(adc::INPUTMODE_INTERNAL);
				ADCB_CH0_MUXCTRL = (ADCB_CH0_MUXCTRL & ~ADC_CH_MUXINT_gm) | input;
			}
void NativeEditBox::keyPressEvent(int keyCode, int nativeCode){
	if(nativeCode > 0){
		setInputMode(EditBox::IM_QWERTY);
	}
	EditBox::keyPressEvent(keyCode, nativeCode);
}
Exemple #16
0
static int
brl_readCommand (BrailleDisplay *brl, KeyTableCommandContext context) {
  unsigned char byte;
  const InputMode *mode;
  const InputBinding *binding;

  {
    int result = serialReadData(serialDevice, &byte, 1, 0, 0);

    if (result == 0) {
      if (inputMode->temporary)
        if (afterTimePeriod(&inputPeriod, NULL))
          resetInputMode();

      return EOF;
    }

    if (result == -1) {
      logSystemError("read");
      return BRL_CMD_RESTARTBRL;
    }
  }

  mode = inputMode;
  if (mode->temporary) resetInputMode();

  switch (byte) {
    case KEY_F1:     binding = &mode->keyF1;     break;
    case KEY_F2:     binding = &mode->keyF2;     break;
    case KEY_LEFT:   binding = &mode->keyLeft;   break;
    case KEY_RIGHT:  binding = &mode->keyRight;  break;
    case KEY_UP:     binding = &mode->keyUp;     break;
    case KEY_DOWN:   binding = &mode->keyDown;   break;
    case KEY_CENTER: binding = &mode->keyCenter; break;

    default:
      logMessage(LOG_WARNING, "unhandled key: %s -> %02X", mode->name, byte);
      beep(brl);
      return EOF;
  }

  switch (binding->type) {
    case IBT_unbound:
      logMessage(LOG_WARNING, "unbound key: %s -> %02X", mode->name, byte);
      beep(brl);
      break;

    case IBT_command:
      return binding->value.command;

    case IBT_block:
      return binding->value.block + cursorOffset;

    case IBT_function:
      return binding->value.function(brl);

    case IBT_submode: {
      setInputMode(binding->value.submode);
      break;
    }

    default:
      logMessage(LOG_WARNING, "unhandled input binding type: %02X", binding->type);
      break;
  }

  return BRL_CMD_NOOP;
}
Exemple #17
0
static void
resetInputMode (void) {
  setInputMode(&inputMode_basic);
}
Exemple #18
0
			inline static void
			setNegativeInput(adc::NegativeInput input)
			{
				setInputMode(adc::INPUTMODE_DIFFERENTIAL);
				ADCA_CH1_MUXCTRL = (ADCA_CH1_MUXCTRL & ~ADC_CH_MUXNEG_gm) | input;
			}