/** * @brief Handles an input event in this phase. * @param event the event */ void SelectionMenuConfirmErase::notify_event(InputEvent &event) { if (event.is_keyboard_key_pressed(validation_keys)) { // to erase a savegame file we don't allow joypad buttons int cursor_position = menu->get_cursor_position(); if (cursor_position == 5) { // the user chose "Yes" menu->play_erase_sound(); delete_save_file(save_number_to_erase); menu->set_next_phase(new SelectionMenuSelectFile(menu, save_number_to_erase + 1)); } else if (cursor_position == 4) { // the user chose "No" menu->play_ok_sound(); menu->set_next_phase(new SelectionMenuSelectFile(menu, 4)); } } if (event.is_direction_pressed() && event.get_direction() % 4 == 0) { // right or left menu->move_cursor_left_or_right(); } }
bool FrameTrigger::isTriggerInputEventEquivalentTo(InputEvent inputEventReceived) { //Compare trigger input event with the one received std::string inputEventReceivedMedium = inputEventReceived.getMedium(); std::string inputEventReceivedMode = inputEventReceived.getMode(); std::string inputEventReceivedTokens = inputEventReceived.getTokens(); std::transform(inputEventReceivedMedium.begin(), inputEventReceivedMedium.end(), inputEventReceivedMedium.begin(), ::tolower); std::transform(inputEventReceivedMode.begin(), inputEventReceivedMode.end(), inputEventReceivedMode.begin(), ::tolower); std::transform(inputEventReceivedTokens.begin(), inputEventReceivedTokens.end(), inputEventReceivedTokens.begin(), ::tolower); std::string triggerInputEventMedium = triggerInputEvent.getMedium(); std::string triggerInputEventMode = triggerInputEvent.getMode(); std::string triggerInputEventTokens = triggerInputEvent.getTokens(); std::transform(triggerInputEventMedium.begin(), triggerInputEventMedium.end(), triggerInputEventMedium.begin(), ::tolower); std::transform(triggerInputEventMode.begin(), triggerInputEventMode.end(), triggerInputEventMode.begin(), ::tolower); std::transform(triggerInputEventTokens.begin(), triggerInputEventTokens.end(), triggerInputEventTokens.begin(), ::tolower); bool result = (inputEventReceivedMedium == triggerInputEventMedium) && (inputEventReceivedMode == triggerInputEventMode) && (inputEventReceivedTokens == triggerInputEventTokens); return result; }
void CoreServices::handleEvent(Event *event) { if(event->getDispatcher() == core->getInput()) { InputEvent *inputEvent = (InputEvent*)event; switch(event->getEventCode()) { case InputEvent::EVENT_KEYDOWN: case InputEvent::EVENT_KEYUP: dispatchEvent(new InputEvent(inputEvent->key, inputEvent->charCode, inputEvent->timestamp), inputEvent->getEventCode()); break; case InputEvent::EVENT_TOUCHES_BEGAN: case InputEvent::EVENT_TOUCHES_ENDED: case InputEvent::EVENT_TOUCHES_MOVED: { InputEvent *event = new InputEvent(); event->touches = inputEvent->touches; event->timestamp = inputEvent->timestamp; dispatchEvent(event, inputEvent->getEventCode()); } break; default: InputEvent *_inputEvent = new InputEvent(inputEvent->mousePosition, inputEvent->timestamp); _inputEvent->mouseButton = inputEvent->mouseButton; dispatchEvent(_inputEvent, inputEvent->getEventCode()); break; } } }
void InputManager::run() { InputEvent* inputEvent; while (running && eventBuffer != NULL) { eventBuffer->waitEvent(); if (!running) { break; } inputEvent = eventBuffer->getNextEvent(); while (inputEvent != NULL) { if (inputEvent->isPressedType() && ((getCurrentTimeMillis() - timeStamp) > 150)) { timeStamp = getCurrentTimeMillis(); if (!dispatchEvent(inputEvent)) { delete inputEvent; inputEvent = eventBuffer->getNextEvent(); continue; } } dispatchProceduralEvent(inputEvent); delete inputEvent; inputEvent = eventBuffer->getNextEvent(); } } }
void UIComboBox::handleEvent(Event *event) { if(event->getDispatcher() == dropDownBox) { switch(event->getEventCode()) { case InputEvent::EVENT_MOUSEMOVE: { InputEvent *inputEvent = (InputEvent*) event; selectedOffset = floor(inputEvent->getMousePosition().y/comboHeight); if(selectedOffset < 0) selectedOffset = 0; if(selectedOffset >= 0 && selectedOffset < items.size()) selectorBox->setPosition(0,selectedOffset*comboHeight); } break; case InputEvent::EVENT_MOUSEDOWN: { setSelectedIndex(selectedOffset); } break; } } if(event->getDispatcher() == dropDownImage || event->getDispatcher() == bgBox) { switch(event->getEventCode()) { case InputEvent::EVENT_MOUSEDOWN: toggleDropDown(); break; } } }
/** * @brief This function is called by the main loop when there is an input event. * @param event the event to handle */ void LanguageScreen::notify_event(InputEvent &event) { static const InputEvent::KeyboardKey validation_keys[] = { InputEvent::KEY_SPACE, InputEvent::KEY_RETURN, InputEvent::KEY_NONE }; if (transition == NULL) { if (event.is_direction_pressed()) { int direction = event.get_direction(); if (direction == 2) { // up set_cursor_position((cursor_position - 1 + nb_languages) % nb_languages); Sound::play("cursor"); } else if (direction == 6) { // down set_cursor_position((cursor_position + 1) % nb_languages); Sound::play("cursor"); } } else if (event.is_keyboard_key_pressed(validation_keys) || event.is_joypad_button_pressed()) { FileTools::set_language(language_codes[cursor_position]); transition = Transition::create(Transition::FADE, Transition::OUT); transition->start(); } } }
bool HudInventory::onInput(const InputEvent &event) { if(event.isMouseOverEvent() && !isMouseOver(event)) m_out_of_item_time = s_desc_visible_time; if(event.isMouseEvent()) m_last_mouse_pos = event.mousePos(); return false; }
//----------------------------------------------------------------------------- // name: on_event_1() // desc: ... //----------------------------------------------------------------------------- t_CKUINT AudicleFaceShredder::on_event_1( const AudicleEvent & event ) { static t_CKUINT m_mouse_down = FALSE; static Point2D last; map<t_CKUINT, Shred_Data *>::iterator iter; t_CKBOOL hit = FALSE; Point2D diff; if( event.type == ae_event_INPUT ) { InputEvent * ie = (InputEvent *)event.data; if( ie->type == ae_input_MOUSE ) { ie->popStack(); for( iter = m_map.begin(); iter != m_map.end(); iter++ ) { if( ie->checkID( (*iter).second->name ) ) { hit = TRUE; if( ie->state == ae_input_DOWN ) (*iter).second->mouse_down = 1; else { if( (*iter).second->mouse_down == 1 ) (*iter).second->mouse_clicked = 1; (*iter).second->mouse_down = 0; if( m_mouse_down ) m_mouse_down = FALSE; fprintf( stderr, "click: %s\n", (*iter).second->stat->name.c_str() ); } } } if( hit == FALSE ) { if( ie->state == ae_input_DOWN ) { m_mouse_down = TRUE; last = ie->pos; } else m_mouse_down = FALSE; } } else if( ie->type == ae_input_MOTION ) { if( m_mouse_down ) { m_eye_y += ( ie->pos - last ).length() * ( ie->pos[1] < last[1] ? 2.0 : -2.0 ); last = ie->pos; //render_view(); } } } return AudicleFace::on_event( event ); }
void PolycodeConsole::handleEvent(Event *event) { if(event->getDispatcher() == CoreServices::getInstance()->getLogger()) { if(event->getEventCode() == Event::NOTIFY_EVENT) { LoggerEvent *loggerEvent = (LoggerEvent*)event; _print(loggerEvent->message); } } else if(event->getDispatcher() == consoleWindow->clearButton) { if(event->getEventType() == "UIEvent" && event->getEventCode() == UIEvent::CLICK_EVENT) { debugTextInput->setText(""); } } else if(event->getDispatcher() == consoleWindow->hideConsoleButton) { globalFrame->hideConsole(); } if(event->getDispatcher() == consoleTextInput) { if(event->getEventCode() == Event::COMPLETE_EVENT && event->getEventType() == "" && consoleTextInput->getText() != "") { _print(">"+consoleTextInput->getText()+"\n"); if(debugger) { if(!debugger->isConnected()) { _print("Unable to inject code. No debugger clients connected.\n"); } else { debugger->injectCode(consoleTextInput->getText()); } } consoleHistory.push_back(consoleTextInput->getText()); if (consoleHistory.size() > consoleHistoryMaxSize) { consoleHistory.erase(consoleHistory.begin()); } consoleHistoryPosition = consoleHistory.size(); consoleTextInput->setText(""); } } if (event->getDispatcher() == CoreServices::getInstance()->getCore()->getInput()) { if (consoleTextInput->hasFocus && event->getEventCode() == InputEvent::EVENT_KEYDOWN) { InputEvent *inputEvent = (InputEvent*)event; if (inputEvent->keyCode() == KEY_UP) { consoleHistoryPosition--; if (consoleHistoryPosition >= 0) { consoleTextInput->setText(consoleHistory.at(consoleHistoryPosition)); } else { consoleHistoryPosition = -1; consoleTextInput->setText(""); } } if (inputEvent->keyCode() == KEY_DOWN) { consoleHistoryPosition++; if (consoleHistoryPosition < consoleHistory.size()) { consoleTextInput->setText(consoleHistory.at(consoleHistoryPosition)); } else { consoleHistoryPosition = consoleHistory.size(); consoleTextInput->setText(""); } } } } }
void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() { status_t status; const uint32_t seq = 15; const int32_t deviceId = 1; const int32_t source = AINPUT_SOURCE_KEYBOARD; const int32_t action = AKEY_EVENT_ACTION_DOWN; const int32_t flags = AKEY_EVENT_FLAG_FROM_SYSTEM; const int32_t keyCode = AKEYCODE_ENTER; const int32_t scanCode = 13; const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON; const int32_t repeatCount = 1; const nsecs_t downTime = 3; const nsecs_t eventTime = 4; status = mPublisher->publishKeyEvent(seq, deviceId, source, action, flags, keyCode, scanCode, metaState, repeatCount, downTime, eventTime); ASSERT_EQ(OK, status) << "publisher publishKeyEvent should return OK"; uint32_t consumeSeq; InputEvent* event; status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); ASSERT_EQ(OK, status) << "consumer consume should return OK"; ASSERT_TRUE(event != NULL) << "consumer should have returned non-NULL event"; ASSERT_EQ(AINPUT_EVENT_TYPE_KEY, event->getType()) << "consumer should have returned a key event"; KeyEvent* keyEvent = static_cast<KeyEvent*>(event); EXPECT_EQ(seq, consumeSeq); EXPECT_EQ(deviceId, keyEvent->getDeviceId()); EXPECT_EQ(source, keyEvent->getSource()); EXPECT_EQ(action, keyEvent->getAction()); EXPECT_EQ(flags, keyEvent->getFlags()); EXPECT_EQ(keyCode, keyEvent->getKeyCode()); EXPECT_EQ(scanCode, keyEvent->getScanCode()); EXPECT_EQ(metaState, keyEvent->getMetaState()); EXPECT_EQ(repeatCount, keyEvent->getRepeatCount()); EXPECT_EQ(downTime, keyEvent->getDownTime()); EXPECT_EQ(eventTime, keyEvent->getEventTime()); status = mConsumer->sendFinishedSignal(seq, true); ASSERT_EQ(OK, status) << "consumer sendFinishedSignal should return OK"; uint32_t finishedSeq = 0; bool handled = false; status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled); ASSERT_EQ(OK, status) << "publisher receiveFinishedSignal should return OK"; ASSERT_EQ(seq, finishedSeq) << "publisher receiveFinishedSignal should have returned the original sequence number"; ASSERT_TRUE(handled) << "publisher receiveFinishedSignal should have set handled to consumer's reply"; }
void UIButton::handleMouse ( const InputEvent &e ) { _selected = e.checkID(_id); if ( _selected && _menu ) { InputEvent sub = e; sub.popStack(); _menu->handleMouse( sub ); } }
void UIScrollBar::handleMouse(const InputEvent &e) { _selected = false; if ( e.checkID(_id) ) { if ( e.state == ae_input_DOWN ) _selected = true; InputEvent sub = e; sub.popStack(); _box.handleMouse ( sub ); } }
void UIMenu::handleMouse( const InputEvent &e ) { _selected = e.checkID ( _id ); if ( _selected ) { InputEvent sub = e; sub.popStack(); for ( int i = 0; i < _options.size(); i++ ) _options[i].button.handleMouse(sub); } }
/** * @brief Handles an input event in this phase. * @param event the event */ void SelectionMenuSelectFile::notify_event(InputEvent &event) { if (!menu->has_transition()) { if (event.is_keyboard_key_pressed(validation_keys) || event.is_joypad_button_pressed()) { menu->play_ok_sound(); int cursor_position = menu->get_cursor_position(); if (cursor_position == 5) { // the user chose "Options" menu->set_next_phase(new SelectionMenuOptions(menu)); } else if (cursor_position == 4) { // the user chose "Erase" menu->set_next_phase(new SelectionMenuEraseFile(menu)); } else { // the user chose a save Savegame **savegames = menu->get_savegames(); if (savegames[cursor_position - 1]->is_empty()) { // the savegame doesn't exist: ask the name menu->set_next_phase(new SelectionMenuChooseName(menu)); } else { // the savegame exists: choose the mode and then start the game menu->set_next_phase(new SelectionMenuChooseMode(menu)); } } } if (event.is_direction_pressed()) { switch (event.get_direction()) { case 6: // down menu->move_cursor_down(); break; case 2: // up menu->move_cursor_up(); break; case 0: // right case 4: // left menu->move_cursor_left_or_right(); break; default: break; } } } }
void InputManager::run(Real elapsedTime) { RL_LONGLONG start = CoreSubsystem::getSingleton().getClock(); CEGUI::System::getSingleton().injectTimePulse(elapsedTime); if (mScheduledInputSwitch == SWITCH_TO_BUFFERED) { switchMouseToBuffered(); mScheduledInputSwitch = SWITCH_NO_SWITCH; return; } else if (mScheduledInputSwitch == SWITCH_TO_UNBUFFERED) { switchMouseToUnbuffered(); mScheduledInputSwitch = SWITCH_NO_SWITCH; return; } if (mNumActiveWindowsKeyboardInput == 0) { mInputReader->capture(); while (mEventQueue->getSize() > 0) { InputEvent* ie = mEventQueue->pop(); if(ie->getID() == KeyEvent::KE_KEY_PRESSED) keyPressed(static_cast<KeyEvent*>(ie)); else if(ie->getID() == KeyEvent::KE_KEY_RELEASED) keyReleased(static_cast<KeyEvent*>(ie)); else if(ie->getID() == KeyEvent::KE_KEY_CLICKED) keyClicked(static_cast<KeyEvent*>(ie)); delete ie; } } if (!mBuffered) { int pressedButtonMask = 0, releasedButtonMask = 0; checkMouseButton(0, MouseEvent::BUTTON0_MASK, pressedButtonMask, releasedButtonMask); checkMouseButton(1, MouseEvent::BUTTON1_MASK, pressedButtonMask, releasedButtonMask); checkMouseButton(2, MouseEvent::BUTTON2_MASK, pressedButtonMask, releasedButtonMask); checkMouseButton(3, MouseEvent::BUTTON3_MASK, pressedButtonMask, releasedButtonMask); if (releasedButtonMask != 0 && mCharacterController!=NULL) mCharacterController->injectMouseUp(releasedButtonMask); if (pressedButtonMask != 0 && mCharacterController!=NULL) mCharacterController->injectMouseDown(pressedButtonMask); } Logger::getSingleton().log( Logger::CORE, Logger::LL_TRIVIAL, " IM time " + Ogre::StringConverter::toString( Ogre::Real((double)(CoreSubsystem::getSingleton().getClock()-start)))); }
void AlertBox::handleMouse( const InputEvent & e ) { UIRectangle::handleMouse( e ); if ( _selected ) { InputEvent sub = e; sub.popStack(); _dismissButton.handleMouse ( sub ) ; if ( _dismissButton.selected() ) { _time_ends = AudicleWindow::main()->get_current_time() + 0.5; } } }
bool HudConsole::onInput(const InputEvent &event) { if(event.keyDown('`') || (event.mouseButtonDown(InputButton::left) && !isMouseOver(event))) { setVisible(false); return true; } if(isVisible() && event.key() >= 32 && event.key() <= 127) return true; //TODO: fixme return false; }
void Game::processInput(InputEvent& e) { //User requests quit if( ! e.getConsumed() && e.getEvent().type == SDL_QUIT ) { e.setConsumed(true); setGameRunning(false); } DEBUG_ASSERT( m_sceneManagerPtr->getCurrentScenePtr() != NULL ) m_sceneManagerPtr->processInput(e); }
/** * @brief Handles an input event in this phase. * @param event the event */ void SelectionMenuOptions::notify_event(InputEvent &event) { if (event.is_direction_pressed()) { int direction = event.get_direction(); if (!modifying) { if (direction == 2) { // up move_cursor_up(); } else if (direction == 6) { // down move_cursor_down(); } } else { if (direction == 0) { // right set_option_next_value(); } else if (direction == 4) { // left set_option_previous_value(); } } } else if (event.is_keyboard_key_pressed(validation_keys) || event.is_joypad_button_pressed()) { if (cursor_position < nb_options) { // set an option if (!modifying) { menu->play_ok_sound(); left_arrow_sprite->restart_animation(); right_arrow_sprite->restart_animation(); label_texts[cursor_position]->set_text_color(Color::get_white()); value_texts[cursor_position]->set_text_color(Color::get_yellow()); menu->set_title_text("selection_menu.phase.options.changing"); modifying = true; } else { menu->play_letter_sound(); label_texts[cursor_position]->set_text_color(Color::get_yellow()); value_texts[cursor_position]->set_text_color(Color::get_white()); menu->set_title_text("selection_menu.phase.options"); modifying = false; } } else if (cursor_position == nb_options) { // back menu->play_ok_sound(); menu->set_next_phase(new SelectionMenuSelectFile(menu, 5)); } } }
void MenuButton::_unhandled_key_input(InputEvent p_event) { if (p_event.is_pressed() && !p_event.is_echo() && (p_event.type==InputEvent::KEY || p_event.type==InputEvent::ACTION || p_event.type==InputEvent::JOYSTICK_BUTTON)) { if (!get_parent() || !is_visible() || is_disabled()) return; if (popup->activate_item_by_event(p_event)) accept_event(); } }
void TrackballCamera::handleEvent(Event *event) { if(event->getDispatcher() == trackballShape) { InputEvent *inputEvent = (InputEvent*) event; switch(event->getEventCode()) { case InputEvent::EVENT_MOUSEDOWN: if(isNavKeyDown() || inputEvent->mouseButton == CoreInput::MOUSE_BUTTON3) { if(coreInput->getKeyState(KEY_LSHIFT) || coreInput->getKeyState(KEY_RSHIFT)) { mouseMode = MOUSE_MODE_PANNING; trackBallMouseStart = Vector2( inputEvent->getMousePosition().x / trackballShape->getWidth(), inputEvent->getMousePosition().y / trackballShape->getHeight() ); trackBallMouseEnd = trackBallMouseStart; } else if(coreInput->getKeyState(KEY_LCTRL) || coreInput->getKeyState(KEY_RCTRL)) { mouseMode = MOUSE_MODE_ZOOMING; trackBallMouseStart = Vector2( inputEvent->getMousePosition().x / trackballShape->getWidth(), inputEvent->getMousePosition().y / trackballShape->getHeight() ); trackBallMouseEnd = trackBallMouseStart; } else { if(!rotationDisabled) { mouseMode = MOUSE_MODE_ORBITING; trackBallMouseStart = trackBallMouseEnd = Vector2( inputEvent->getMousePosition().x / trackballShape->getWidth(), inputEvent->getMousePosition().y / trackballShape->getHeight() ); } } } break; case InputEvent::EVENT_MOUSEUP: case InputEvent::EVENT_MOUSEUP_OUTSIDE: mouseMode = MOUSE_MODE_IDLE; break; case InputEvent::EVENT_MOUSEMOVE: processMouseMovement(inputEvent->getMousePosition()); break; case InputEvent::EVENT_MOUSEWHEEL_UP: cameraDistance *= 0.9; updateCamera(); break; case InputEvent::EVENT_MOUSEWHEEL_DOWN: cameraDistance *= 1.1; updateCamera(); break; } return; } }
void InputEventBase::execSyncV( FieldContainer &oFrom, ConstFieldMaskArg whichField, AspectOffsetStore &oOffsets, ConstFieldMaskArg syncMode, const UInt32 uiSyncInfo) { InputEvent *pThis = static_cast<InputEvent *>(this); pThis->execSync(static_cast<InputEvent *>(&oFrom), whichField, oOffsets, syncMode, uiSyncInfo); }
void ShredInstance::handleMouse( const InputEvent & e ) { DragManager * dm = DragManager::instance(); selected = false; if ( e.checkID(pickID) ) { InputEvent sub = e; sub.popStack(); _killButton->handleMouse(sub); if ( e.state == ae_input_DOWN ) selected = true; dragAction( dm ); } }
void BaseButton::_unhandled_input(InputEvent p_event) { if (!is_disabled() && is_visible() && p_event.is_pressed() && !p_event.is_echo() && shortcut.is_valid() && shortcut->is_shortcut(p_event)) { if (get_viewport()->get_modal_stack_top() && !get_viewport()->get_modal_stack_top()->is_a_parent_of(this)) return; //ignore because of modal window if (is_toggle_mode()) { set_pressed(!is_pressed()); emit_signal("toggled",is_pressed()); } emit_signal("pressed"); } }
//----------------------------------------------------------------------------- // name: main_mouse() // desc: ... //----------------------------------------------------------------------------- void AudicleWindow::main_mouse( int button, int state, int x, int y) { assert( this == AudicleWindow::main() ); set_mouse_coords( x, y ); //fetch pick stack main_pick(); t_CKUINT * temp_stack = (t_CKUINT*) malloc ( m_pick_size * sizeof(t_CKUINT) ); memcpy ( (void*)temp_stack, (void*)m_pick_top, m_pick_size * sizeof(t_CKUINT) ); // create mouse input event InputEvent* ev = new InputEvent ( ae_input_MOUSE, m_cur_pt, button, state ); ev->setMods( glutGetModifiers() ); ev->setStack( temp_stack , m_pick_size ); ev->time = get_current_time(); InputEvent sub = *ev; //START AN AUDICLE EVENT //make_mouse_event( m_cur_pt, button, state ); AudicleEvent event; event.type = ae_event_INPUT; event.message = 2; event.param1 = button; event.param2 = state; event.data = (void *) ev; Audicle::instance()->face()->on_event( event ); sub.popStack(); // if( m_console ) // { // m_console->handleMouse( sub ); // m_console->handleMouseAlerts( sub ); // } free (temp_stack); delete ev; //XXX assumes unqueued... // if ( wm ) wm->handleMouse(button, state, cur_pt); // if ( DragManager::instance()->object() ) { } }
/** * @brief This function is called by the main loop when there is an input event. * @param event the event to handle */ void TitleScreen::notify_event(InputEvent &event) { static const InputEvent::KeyboardKey keys[] = { InputEvent::KEY_SPACE, InputEvent::KEY_RETURN, InputEvent::KEY_NONE }; if (event.is_keyboard_key_pressed(InputEvent::KEY_ESCAPE)) { solarus.set_exiting(); } else if (current_phase == PHASE_TITLE && (event.is_joypad_button_pressed() || event.is_keyboard_key_pressed(keys)) && counter >= 1 && !transition_out->is_started() && !transition_out->is_finished()) { transition_out->start(); } }
void TextContent::handleMouse(const InputEvent &e) { _inp.setEvent(e, _viewport.vpToLocal(e.pos)); //_inp.lastPos.printnl(); if ( e.state == ae_input_DOWN ) { _selected = e.checkID(_id); } //check the parse tree? if ( _selected ) { if ( _inp.isDepressed ) { _loc = mouseToLoc( _inp.lastPos ); _magicCharPos = _loc.chr; _markLoc = _loc; } _markSpan = TextSpan(_loc, _markLoc ); _buf->closeEdit(); } }
void ConsoleWindow::handleMouseUI( const InputEvent & e ) { if ( e.state == ae_input_DOWN && _selected ) activate(); for ( int i = 0 ; i < 6 ; i ++ ) { if ( e.state == ae_input_DOWN && e.checkID(_cubeSides[i].id()) ) { Audicle::instance()->move_to( i ); setCubes(); } } _timeLabel.handleMouse(e); _timeDisplay.handleMouse(e); _curLabel.handleMouse(e); _curDisplay.handleMouse(e); _prevLabel.handleMouse(e); _prevDisplay.handleMouse(e); _cubeWindow.handleMouse(e); _sizeBox.handleMouse(e); if ( e.state == ae_input_DOWN && _sizeBox.selected() ) { deactivate(); } }
void UIRectangle::handleMouse ( const InputEvent & e) { _selected = false; if ( e.state == ae_input_UP || e.size == 0 ) return ; _selected = e.checkID(_id ); }
bool InputActionMapper::handleEvent( const InputEvent& event ) { // See if we have a global input action for this event InputActionStack* foundAction = find( event ); // If we couldn't find the action for the event, the input event may be // handled by one of the other methods of mapping input events to actions if( !foundAction ) { // First check to see if it's handled by any of the active key ranges if( event.isKeyType() ) { int rangeCount = actionsByKeyRange.size(); for( int i=0; i<rangeCount; ++i ) { InputKeyRange& keyRange = actionsByKeyRange[i].first; if( event.keyEvent.keyCode >= keyRange.keyCodeLow && event.keyEvent.keyCode <= keyRange.keyCodeHigh ) { foundAction = actionsByKeyRange[i].second; } } } } // If we were able to find an action for the event, try to handle the event if( foundAction && foundAction->execute( event ) ); return true; return false; }