EVENT_RESULT CGUISpinControl::OnMouseEvent(const CPoint &point, const CMouseEvent &event) { if (event.m_id == ACTION_MOUSE_LEFT_CLICK) { if (m_imgspinUpFocus.HitTest(point)) MoveUp(); else if (m_imgspinDownFocus.HitTest(point)) MoveDown(); return EVENT_RESULT_HANDLED; } else if (event.m_id == ACTION_MOUSE_WHEEL_UP) { if (m_imgspinUpFocus.HitTest(point) || m_imgspinDownFocus.HitTest(point)) { MoveUp(); return EVENT_RESULT_HANDLED; } } else if (event.m_id == ACTION_MOUSE_WHEEL_DOWN) { if (m_imgspinUpFocus.HitTest(point) || m_imgspinDownFocus.HitTest(point)) { MoveDown(); return EVENT_RESULT_HANDLED; } } return EVENT_RESULT_UNHANDLED; }
void Camera::Input() { float sensitivity = 0.001f; float movAmt = static_cast<float>(10 * Time::GetDelta()); float rotAmt = static_cast<float>(1.5f * Time::GetDelta()); if (Input::GetMouseDown(GLFW_MOUSE_BUTTON_1)) { m_cursorStoredPos = Input::GetCursorPosition(); vec2 centerPos = vec2((float)WIDTH / 2.0f, (float)WIDTH / 2.0f); Input::SetCursorPosition(centerPos); Input::SetCursorVisibility(false); m_mouselocked = true; } if (Input::GetMouseUp(GLFW_MOUSE_BUTTON_1)) { Input::SetCursorPosition(m_cursorStoredPos); Input::SetCursorVisibility(true); m_mouselocked = false; } if (m_mouselocked) { vec2 centerPos = vec2((float)WIDTH / 2.0f, (float)WIDTH / 2.0f); vec2 currentPos = Input::GetCursorPosition(); vec2 deltaPos = centerPos - currentPos; bool rotY = deltaPos.x != 0; bool rotX = deltaPos.y != 0; if (rotY) RotateY(deltaPos.x * sensitivity); if (rotX) RotateX(deltaPos.y * sensitivity); if (rotY || rotX) Input::SetCursorPosition(centerPos); } if (Input::GetKey(GLFW_KEY_W)) { MoveUp(movAmt); } if (Input::GetKey(GLFW_KEY_S)) { MoveUp(-movAmt); } if (Input::GetKey(GLFW_KEY_D)) { MoveRight(movAmt); } if (Input::GetKey(GLFW_KEY_A)) { MoveRight(-movAmt); } }
bool UIListBtnType::MoveItemUpDown(UIListBtnTypeItem *item, bool flag) { if (item != m_selItem) { cerr << "Can't move non-selected item\n"; return false; } if (item == m_itemList.getFirst() && flag) return false; if (item == m_itemList.getLast() && !flag) return false; int oldpos = m_selPosition; int insertat = 0; bool dolast = false; if (flag) { insertat = m_selPosition - 1; if (item == m_itemList.getLast()) dolast = true; else ++m_selPosition; if (item == m_topItem) ++m_topPosition; } else insertat = m_selPosition + 1; if (m_itemList.current() == item) { m_itemList.take(); // cout << "speedy\n"; } else m_itemList.take(oldpos); m_itemList.insert(insertat, item); if (flag) { MoveUp(); if (!dolast) MoveUp(); } else MoveDown(); return true; }
void Game_Player::Update() { bool last_moving = IsMoving(); if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning() && !IsMoveRouteOverwritten() && !Game_Message::message_waiting) { switch (Input::dir4) { case 2: MoveDown(); break; case 4: MoveLeft(); break; case 6: MoveRight(); break; case 8: MoveUp(); } } int last_real_x = real_x; int last_real_y = real_y; Game_Character::Update(); UpdateScroll(last_real_x, last_real_y); UpdateNonMoving(last_moving); }
void BfsHelper::EvaluateShortestPaths(std::pair<int, int> pos, int steps) { EvaluateShortestPathsHelper(pos, MoveLeft(pos), steps); EvaluateShortestPathsHelper(pos, MoveRight(pos), steps); EvaluateShortestPathsHelper(pos, MoveUp(pos), steps); EvaluateShortestPathsHelper(pos, MoveDown(pos), steps); }
void Reset() { uiOpFerTimer = urand(15000,20000); uiCycloneTimer = 3000; uiBoltTimer = 7000; uiThunderTimer = 12000; bOpFerok = false; bOpFerokFail = false; bOnGround = false; bCanDown = false; if (pInstance) { if (!FirstTime) pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, FAIL); pInstance->SetData64(DATA_PL_JEDOGA_TARGET, 0); pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); } MoveUp(); FirstTime = false; }
bool TaskEditPanel::OnKeyDown(unsigned key_code) { switch (key_code){ case VK_ESCAPE: if (IsAltair() && wTaskPoints->HasFocus()){ wf.FocusFirstControl(); return true; } return false; case '6': /* F5 */ if (IsAltair()) { MoveUp(); return true; } else return false; case '7': /* F6 */ if (IsAltair()) { MoveDown(); return true; } else return false; default: return false; } }
bool CGUIFixedListContainer::MoveUp(bool wrapAround) { if (m_offset > -m_cursor) ScrollToOffset(m_offset - 1); else if (wrapAround) { if (m_items.size() > 0) { // move 2 last item in list int offset = m_items.size() - m_cursor - 1; if (offset < -m_cursor) offset = -m_cursor; ScrollToOffset(offset); g_infoManager.SetContainerMoving(GetID(), -1); } } else return false; if (m_items.size() > (size_t) (m_offset +m_cursor) && m_items[m_offset +m_cursor]->GetPropertyBOOL("isseparator")) { if (m_offset +m_cursor == 0) { MoveDown(wrapAround); if (!wrapAround) return false; } else { MoveUp(wrapAround); } } return true; }
void Reset() { uiCycloneTimer = 3*IN_MILLISECONDS; uiBoltTimer = 7*IN_MILLISECONDS; uiThunderTimer = 12*IN_MILLISECONDS; uiHealthAmountModifier = 1; bOpFerok = false; bOpFerokFail = false; bOnGround = false; bCanDown = false; bAchiev = true; if (pInstance) { if (!bFirstTime) pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, FAIL); pInstance->SetData64(DATA_PL_JEDOGA_TARGET, 0); pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); } MoveUp(); bFirstTime = false; }
bool TaskEditPanel::OnKeyDown(unsigned key_code) { switch (key_code){ case KEY_ESCAPE: if (IsAltair() && GetList().HasFocus()){ dialog.FocusFirstControl(); return true; } return false; case '6': /* F5 */ if (IsAltair()) { MoveUp(); return true; } else return false; case '7': /* F6 */ if (IsAltair()) { MoveDown(); return true; } else return false; default: return false; } }
void TaskEditPanel::OnAction(int id) { switch (id) { case EDIT: OnEditTurnpointClicked(); break; case MUTATE: OnMakeFinish(); break; case UP: MoveUp(); break; case DOWN: MoveDown(); break; case REVERSE: ReverseTask(); break; case CLEAR_ALL: OnClearAllClicked(); break; } }
int CGUIListBox::Keyboard(UINT character, UINT state) { if(character == VK_RETURN) { if(markListItem) EventArise(EList,0,markListItem->GetID(),0,0,0); } if (character == VK_UP) { MoveUp(); } if (character == VK_DOWN) { MoveDown(); } if (character == VK_RIGHT) { MoveRight(); } if (character == VK_LEFT) { MoveLeft(); } return 1; }
void CChatWindow::AddInfoDebugMessage(const char * szFormat, ...) { // Ensure we have a valid format string if(!szFormat) return; #ifdef _DEBUG MoveUp(); va_list vaArgs; va_start(vaArgs, szFormat); vsnprintf(m_chatMessages[0].szMessage, MAX_MESSAGE_LENGTH, szFormat, vaArgs); va_end(vaArgs); m_chatMessages[0].szMessage[MAX_MESSAGE_LENGTH] = '\0'; m_chatMessages[0].messageColor = MESSAGE_INFO_COLOR; m_chatMessages[0].fNameExtent = 0; m_chatMessages[0].bAllowFormatting = true; m_iMessageAmount++; // Write info to log CLogFile::Open("Chatlog.log",true); CLogFile::Printf("DEBUG: %s",m_chatMessages[0].szMessage); CLogFile::Close(); CLogFile::Open("Client.log",true);//Reopen client.log #endif }
/******************************************************************************** Fly ********************************************************************************/ void Camera3::Fly(const double dt) { if(dt > 0) MoveUp(dt); else if(dt < 0) MoveDown(dt); }
bool CGUIFixedListContainer::MoveDown(bool wrapAround) { if (m_offset + m_cursor + 1 < (int)m_items.size()) { ScrollToOffset(m_offset + 1); } else if (wrapAround) { // move first item in list ScrollToOffset(-m_cursor); g_infoManager.SetContainerMoving(GetID(), 1); } else return false; if (m_items.size() > (size_t) (m_offset +m_cursor) && m_items[m_offset +m_cursor]->GetPropertyBOOL("isseparator")) { if ((size_t) (m_offset +m_cursor) == m_items.size() - 1) { MoveUp(wrapAround); if (!wrapAround) return false; } else { MoveDown(wrapAround); } } return true; }
QueueManager::QueueManager(QWidget* parent) : QDialog(parent), ui_(new Ui_QueueManager), playlists_(nullptr), current_playlist_(nullptr) { ui_->setupUi(this); ui_->list->setItemDelegate(new QueuedItemDelegate(this, 0)); // Set icons on buttons ui_->move_down->setIcon(IconLoader::Load("go-down")); ui_->move_up->setIcon(IconLoader::Load("go-up")); ui_->remove->setIcon(IconLoader::Load("edit-delete")); ui_->clear->setIcon(IconLoader::Load("edit-clear-list")); // Set a standard shortcut ui_->remove->setShortcut(QKeySequence::Delete); // Button connections connect(ui_->move_down, SIGNAL(clicked()), SLOT(MoveDown())); connect(ui_->move_up, SIGNAL(clicked()), SLOT(MoveUp())); connect(ui_->remove, SIGNAL(clicked()), SLOT(Remove())); connect(ui_->clear, SIGNAL(clicked()), SLOT(Clear())); QShortcut* close = new QShortcut(QKeySequence::Close, this); connect(close, SIGNAL(activated()), SLOT(close())); }
// Update void Game_Player::Update() { bool last_moving = IsMoving(); if (!IsMoving() && !Game_Map::GetInterpreter().IsRunning() /*move_route_forcing || Game_Temp::message_window_showing*/) { switch (Input::dir4) { case 2: MoveDown(); break; case 4: MoveLeft(); break; case 6: MoveRight(); break; case 8: MoveUp(); } } int last_real_x = real_x; int last_real_y = real_y; Game_Character::Update(); UpdateScroll(last_real_x, last_real_y); UpdateNonMoving(last_moving); }
bool Dock::HandleEvent( sf::Event &e ) { if( e.Type == sf::Event::KeyPressed ) { switch( e.Key.Code ) { case sf::Key::Escape: Deactivate(); break; case sf::Key::Up: MoveUp(); break; case sf::Key::Down: MoveDown(); break; case sf::Key::Left: MoveLeft(); break; case sf::Key::Right: MoveRight(); break; case sf::Key::Return: case sf::Key::Space: Execute(); break; default: break; } } return true; }
void CameraControl::OnExcute(float sec) { float move_speed = m_move_speed; // 前后移动 float len = sec * move_speed * m_fDirection; if (len != 0) { // 前后平移 MoveFront(-len); } // 上下移动 float len1 = sec * move_speed * m_fUpDirection; if (len1 != 0) { MoveUp(len1); } // 左右平移 float delta = sec * move_speed * m_fShiftDirection; if (delta != 0) { MoveShift(delta); } }
void Reset() { uiOpFerTimer = urand(15*IN_MILLISECONDS, 20*IN_MILLISECONDS); uiCycloneTimer = 3*IN_MILLISECONDS; uiBoltTimer = 7*IN_MILLISECONDS; uiThunderTimer = 12*IN_MILLISECONDS; bOpFerok = false; bOpFerokFail = false; bOnGround = false; bCanDown = false; volunteerWork = true; if(pInstance) { if(!bFirstTime) pInstance->SetData(DATA_JEDOGA_SHADOWSEEKER_EVENT, FAIL); pInstance->SetData64(DATA_PL_JEDOGA_TARGET, 0); pInstance->SetData64(DATA_ADD_JEDOGA_OPFER, 0); pInstance->SetData(DATA_JEDOGA_RESET_INITIANDS, 0); } MoveUp(); bFirstTime = false; }
void Game_Character::MoveTypeCycleUpDown() { if (IsStopping()) { cycle_stat ? MoveUp() : MoveDown(); cycle_stat = move_failed ? !cycle_stat : cycle_stat; } }
void TradeTable::mousePressEvent(QMouseEvent * event) { QModelIndex modelIndex = indexAt(event->pos()); if (event->button() == Qt::RightButton) { QMenu * popupMenu = new QMenu(this); QString menuStyle = "QMenu { font-size:18px; color:blue; background-color:qlineargradient(x1:0, y1:0, x2:0, y2:1, stop: 0 #cccccc, stop: 1 #555555);}" ; popupMenu->setStyleSheet(menuStyle); m_SelectedIndex = modelIndex.row(); if(modelIndex.isValid() && modelIndex.row()>=0) { this->setSelection(this->visualRect(modelIndex),QItemSelectionModel::SelectCurrent); popupMenu->addAction(tr("&Order"), this, SLOT(Order()),QKeySequence(Qt::CTRL + Qt::Key_O)); popupMenu->addAction(tr("&Chart"),this,SLOT(Chart()),QKeySequence(Qt::CTRL + Qt::Key_C)); popupMenu->addSeparator(); popupMenu->addAction(tr("&Delete"),this,SLOT(Delete()),QKeySequence(Qt::CTRL + Qt::Key_D)); popupMenu->addAction(tr("&Add"),this,SLOT(Add()),QKeySequence(Qt::CTRL + Qt::Key_A)); popupMenu->addAction(tr("&Move&Up"),this,SLOT(MoveUp()),QKeySequence(Qt::CTRL + Qt::Key_M,Qt::CTRL + Qt::Key_U)); popupMenu->addAction(tr("&UpTo&Top"),this,SLOT(UpToTop()),QKeySequence(Qt::CTRL + Qt::Key_U,Qt::CTRL + Qt::Key_T)); popupMenu->addAction(tr("&Move&Down"),this,SLOT(MoveDown()),QKeySequence(Qt::CTRL + Qt::Key_M,Qt::CTRL + Qt::Key_D)); popupMenu->addAction(tr("&DownTo&Bottom"),this,SLOT(DownToBottom()),QKeySequence(Qt::CTRL + Qt::Key_D,Qt::CTRL + Qt::Key_B)); } else { popupMenu->addAction(tr("&Add"),this,SLOT(Add()),QKeySequence(Qt::CTRL + Qt::Key_A)); } popupMenu->exec(event->globalPos()); } QTableView::mousePressEvent(event); }
SelectWidget::SelectWidget() { list = new QListWidget(this); upButton = new QPushButton(this); downButton = new QPushButton(this); connect(upButton, SIGNAL(clicked()), this, SLOT(MoveUp())); connect(downButton, SIGNAL(clicked()), this, SLOT(MoveDown())); list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); }
int EList::ExecCommand(int Command, ExState &State) { int W = 1; int H = 1; if (View && View->MView && View->MView->Win) { View->MView->ConQuerySize(&W, &H); H--; } FixPos(); switch (Command) { case ExMoveLeft: return MoveLeft(); case ExMoveRight: return MoveRight(); case ExMoveUp: return MoveUp(); case ExMoveDown: return MoveDown(); case ExMovePageUp: return MovePageUp(); case ExMovePageDown: return MovePageDown(); case ExScrollLeft: return ScrollLeft(8); case ExScrollRight: return ScrollRight(8); case ExMovePageStart: return MovePageStart(); case ExMovePageEnd: return MovePageEnd(); case ExMoveFileStart: return MoveFileStart(); case ExMoveFileEnd: return MoveFileEnd(); case ExMoveLineStart: return MoveLineStart(); case ExMoveLineEnd: return MoveLineEnd(); case ExRescan: RescanList(); return ErOK; case ExActivate: return Activate(); case ExListMark: return Mark(); case ExListUnmark: return Unmark(); case ExListToggleMark: return ToggleMark(); case ExListMarkAll: return MarkAll(); case ExListUnmarkAll: return UnmarkAll(); case ExListToggleMarkAll: return ToggleMarkAll(); } return EModel::ExecCommand(Command, State); }
void cBall::Move(int *map) { int state = GetState(); if (state == STATE_WALKLEFT) MoveLeft(map); else if (state == STATE_WALKRIGHT) MoveRight(map); else if (state == STATE_WALKDOWN) MoveDown(map); else if (state == STATE_WALKUP) MoveUp(map); }
void CGUIBaseContainer::OnUp() { CGUIAction action = GetAction(ACTION_MOVE_UP); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (m_orientation == VERTICAL && MoveUp(wrapAround)) return; // with horizontal lists it doesn't make much sense to have multiselect labels CGUIControl::OnUp(); }
void Game_Character::MoveAwayFromPlayer() { int sx = DistanceXfromPlayer(); int sy = DistanceYfromPlayer(); if (sx != 0 || sy != 0) { if ( std::abs(sx) > std::abs(sy) ) { (sx > 0) ? MoveRight() : MoveLeft(); if (move_failed && sy != 0) { (sy > 0) ? MoveDown() : MoveUp(); } } else { (sy > 0) ? MoveDown() : MoveUp(); if (move_failed && sx != 0) { (sx > 0) ? MoveRight() : MoveLeft(); } } } }
void CGUIPanelContainer::OnUp() { CGUIAction action = GetAction(ACTION_MOVE_UP); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (m_orientation == VERTICAL && MoveUp(wrapAround)) return; if (m_orientation == HORIZONTAL && MoveLeft(wrapAround)) return; CGUIControl::OnUp(); }
int EBuffer::MoveLeft() { if (CP.Col == 0) { if (CursorWithinEOL == 1 && MoveUp()) return MoveLineEnd(); else return 0; } SetPos(CP.Col - 1, CP.Row, tmLeft); return 1; }
void UIListTreeType::GoHome() { while(curlevel > 0) { MoveLeft(false); } MoveUp(MoveMax); Redraw(); }