int ChangeEnergySpeed::Editor_CaptureGadget(const IPoint& mouse_pos, int x, int y) { // Преобразовываем координаты к координатам на поле int mx = mouse_pos.x + GameSettings::FieldCoordMouse().x; int my = mouse_pos.y + GameSettings::FieldCoordMouse().y; IRect r (mx - (GameSettings::SQUARE_SIDE / 2), my - (GameSettings::SQUARE_SIDE / 2), 0, 0); r.Inflate((GameSettings::SQUARE_SIDE / 2)); _sliderRect = IRect(_snapPoint.x * GameSettings::SQUARE_SIDE,_snapPoint.y * GameSettings::SQUARE_SIDE - 30,200,30); if (r.Contains(_snapPoint * GameSettings::SQUARE_SIDE)) { return (-2); } else if (_sliderRect.Contains(IPoint(mx,my))) { return (-3); } else { return (-1); } }
void SquareNewInfo::Editor_CopyToClipboard(IRect part) { Game::FieldAddress offset(part.x, part.y); _clipboard.clear(); for(std::map<Game::FieldAddress, InfoSquare>::iterator itr = _info.begin(); itr != _info.end(); ++itr) { if( part.Contains(itr->first.ToPoint()) ) _clipboard.insert( std::make_pair(itr->first - offset, itr->second) ); } }
void SquareNewInfo::Editor_ClearFieldPart(IRect part) { for(std::map<Game::FieldAddress, InfoSquare>::iterator itr = _info.begin(); itr != _info.end(); ) { if( part.Contains(itr->first.ToPoint()) ) { itr = _info.erase(itr); } else { ++itr; } } }
void LockBarriers::Editor_CutToClipboard(IRect part) { _clipboard.clear(); for(Barriers::iterator itr = _barriers.begin(); itr != _barriers.end(); ) { if( part.Contains((*itr)->GetPos()) ) { (*itr)->SetPos( (*itr)->GetPos() - part.LeftBottom() ); _clipboard.push_back(*itr); itr = _barriers.erase(itr); } else { ++itr; } } }