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 UpdateAI(const uint32 diff) { if(!pInstance) return; if(pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS && pInstance->GetData(DATA_ALL_INITIAND_DEAD)) MoveDown(); if(bOpFerok && !bOnGround && !bCanDown) Opfern(); if(bOpFerokFail && !bOnGround && !bCanDown) bCanDown = true; if(bCanDown) { MoveDown(); bCanDown = false; } if(bOnGround) { if(!UpdateVictim()) return; if(uiCycloneTimer <= diff) { DoCast(me, SPELL_CYCLONE_STRIKE, false); uiCycloneTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else uiCycloneTimer -= diff; if(uiBoltTimer <= diff) { if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) me->CastSpell(target, DUNGEON_MODE(SPELL_LIGHTNING_BOLT, SPELL_LIGHTNING_BOLT_H), false); uiBoltTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else uiBoltTimer -= diff; if(uiThunderTimer <= diff) { if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true)) me->CastSpell(target, DUNGEON_MODE(SPELL_THUNDERSHOCK, SPELL_THUNDERSHOCK_H), false); uiThunderTimer = urand(15*IN_MILLISECONDS, 30*IN_MILLISECONDS); } else uiThunderTimer -= diff; if(uiOpFerTimer <= diff) MoveUp(); else uiOpFerTimer -= diff; DoMeleeAttackIfReady(); } }
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 Game_Character::MoveTypeCycleUpDown() { if (IsStopping()) { cycle_stat ? MoveUp() : MoveDown(); cycle_stat = move_failed ? !cycle_stat : cycle_stat; } }
int EBuffer::LineNew() { if (SplitLine(VToR(CP.Row), CP.Col) == 0) return 0; if (!MoveDown()) return 0; if (CP.Col > 0) { if (!MoveLineStart()) return 0; //int Indent = LineIndented(VToR(CP.Row)); if (!LineIndent()) return 0; //if (Indent > 0) // if (InsText(Row, C, Indent, 0) == 0) // return 0; if (BFI(this, BFI_Trim)) if (TrimLine(VToR(CP.Row - 1)) == 0) return 0; } return 1; }
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); }
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); }
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; } }
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 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 CatAxeParens( void ) { //============================== // Remove LBR on ( // sequence. // // Before: | After: // --------------- | --------------- // | opr1 | PHI | | released** // --------------- | --------------- // CIT ==> | ( | opn2 | | CIT ==> | opr1 | opn2 | // --------------- | --------------- // | // | opn3 | | | // | opn3 | // --------------- | --------------- // ... | ... // // ** see KillOpnOpr() for case where first node is start-node of expr BackTrack(); ReqNOpn(); MoveDown(); if( CITNode->is_catparen ) { KillOpnOpr(); } else { FiniCat(); } }
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; }
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; }
/******************************************************************************** Fly ********************************************************************************/ void Camera3::Fly(const double dt) { if(dt > 0) MoveUp(dt); else if(dt < 0) MoveDown(dt); }
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; } }
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; } }
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); }
void Update(float interval) { p_fall_timer += p_fall_speed * interval; if (p_fall_timer >= 1) { p_fall_timer -= 1; MoveDown(); } }
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 CGUIBaseContainer::OnDown() { CGUIAction action = GetAction(ACTION_MOVE_DOWN); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (m_orientation == VERTICAL && MoveDown(wrapAround)) return; // with horizontal lists it doesn't make much sense to have multiselect labels CGUIControl::OnDown(); }
void main(void) { int nFrame, nStay; int x, y; SetCursorType(NOCURSOR), init_rand(); for (; 1;) // 게임이 끝났을 경우 다시 시작하거나 끝내는 루프 { Score = 0, bricknum = 0; CLS; // 무한루프에 들어가기전 초기화 for (x = 0; x < BW + 2; x++) // 외부벽 초기화 { for (y = 0; y < BH + 2; y++) { board[x][y] = (y == 0 || y == BH + 1 || x == 0 || x == BW + 1) ? WALL : EMPTY; } } DrawScreen(); nFrame = 10; nbrick = make_rand(sizeof(Shape) / sizeof(Shape[0])); for (; 2;) // 전체 게임 루프 { bricknum++; brick = nbrick; nbrick = make_rand(sizeof(Shape) / sizeof(Shape[0])); // 새 벽돌 생성 DrawNext(); //DrawPresent() nx = BW / 2, ny = 2; rot = 0; PrintBrick(TRUE); if (GetAround(nx, ny, brick, rot) != EMPTY) break; // 게임 끝 점검 nStay = nFrame; for (; 3;) // 벽돌 하나 처리 루프 { if (--nStay == 0) { nStay = nFrame; if (MoveDown()) break; // 벽돌 내림 } if (ProcessKey()) break; // 키처리 delay(1000 / 20); // 시간 지연 } if (bricknum % 5 == 0 && nFrame > 3) nFrame--; } CLS; gotoxy(30, 12), puts("G A M E O V E R"); // 게임 끝 처리 gotoxy(23, 14), puts("If you want restart game press [ Y ]"); // 재시작 gotoxy(27, 16), puts("another any key [ Exit ]"); if (tolower(getch()) != 'y') break; } SetCursorType(NORMALCURSOR); }
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 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::OnDown() { CGUIAction action = GetAction(ACTION_MOVE_DOWN); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (m_orientation == VERTICAL && MoveDown(wrapAround)) return; if (m_orientation == HORIZONTAL && MoveRight(wrapAround)) return; return CGUIControl::OnDown(); }
int EBuffer::MoveRight() { if (CursorWithinEOL == 1 && CP.Col == LineLen()) { if (MoveDown()) return MoveLineStart(); else return 0; } SetPos(CP.Col + 1, CP.Row, tmRight); return 1; }
void AdvError( int code ) { //============================ // Advance CITNode, call error routine, reset CITNode. // Use this routine to get error-pointer ( "carrot" ) in proper place MoveDown(); Error( code ); BackTrack(); }
void EditTOC::ConnectSignalsToSlots() { connect(this, SIGNAL(accepted()), this, SLOT(Save())); connect(ui.AddEntryAbove, SIGNAL(clicked()), this, SLOT(AddEntryAbove())); connect(ui.AddEntryBelow, SIGNAL(clicked()), this, SLOT(AddEntryBelow())); connect(ui.DeleteEntry, SIGNAL(clicked()), this, SLOT(DeleteEntry())); connect(ui.MoveLeft, SIGNAL(clicked()), this, SLOT(MoveLeft())); connect(ui.MoveRight, SIGNAL(clicked()), this, SLOT(MoveRight())); connect(ui.MoveUp, SIGNAL(clicked()), this, SLOT(MoveUp())); connect(ui.MoveDown, SIGNAL(clicked()), this, SLOT(MoveDown())); connect(m_MoveUp, SIGNAL(triggered()), this, SLOT(MoveUp())); connect(m_MoveDown, SIGNAL(triggered()), this, SLOT(MoveDown())); connect(ui.SelectTarget, SIGNAL(clicked()), this, SLOT(SelectTarget())); connect(ui.TOCTree, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(OpenContextMenu(const QPoint &))); connect(m_Rename, SIGNAL(triggered()), this, SLOT(Rename())); connect(m_Delete, SIGNAL(triggered()), this, SLOT(DeleteEntry())); connect(m_CollapseAll, SIGNAL(triggered()), this, SLOT(CollapseAll())); connect(m_ExpandAll, SIGNAL(triggered()), this, SLOT(ExpandAll())); }
void CGUIPanelContainer::OnRight() { CGUIAction action = GetAction(ACTION_MOVE_RIGHT); bool wrapAround = action.GetNavigation() == GetID() || !action.HasActionsMeetingCondition(); if (GetGlobalWrapDisable()) wrapAround = false; if (m_orientation == VERTICAL && MoveRight(wrapAround)) return; if (m_orientation == HORIZONTAL && MoveDown(wrapAround)) return; return CGUIControl::OnRight(); }