Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool _ctrl = false;
- bool vec1set = false;
- bool vec2set = false;
- if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::LControl) && LeftMouseDown && Layer == 1)
- {
- _ctrl = true;
- for(GridRowVector::size_type i = 0; i < RowVector.size(); i ++)
- {
- for(GridColumnVector::size_type j = 0; j < ColumnVector.size(); j++)
- {
- if (MousePos.x >= ColumnVector[j]->getPoint().x &&
- MousePos.x <= ColumnVector[j]->getPoint().x + 32 &&
- MousePos.y >= RowVector[i]->getPoint().y &&
- MousePos.y <= RowVector[i]->getPoint().y + 32 &&
- SettingSquare == false)
- {
- DrawVec1 = sf::Vector2f(ColumnVector[j]->getPoint().x,RowVector[i]->getPoint().y);
- cout << " VEC1 SET" << endl;
- vec1set = true;
- SettingSquare = true;
- }
- }
- }
- }
- if (vec1set = true && (Event.Type == Event.MouseButtonReleased && Event.MouseButton.Button == sf::Mouse::Left) /*Event.Type == sf::Event::MouseButtonReleased) && LeftMouseDown*/ /*(Event.MouseButton.Button == sf::Mouse::Left)*/)
- {
- for(GridRowVector::size_type i = 0; i < RowVector.size(); i ++)
- {
- for(GridColumnVector::size_type j = 0; j < ColumnVector.size(); j++)
- {
- if (MousePos.x >= ColumnVector[j]->getPoint().x &&
- MousePos.x <= ColumnVector[j]->getPoint().x + 32 &&
- MousePos.y >= RowVector[i]->getPoint().y &&
- MousePos.y <= RowVector[i]->getPoint().y + 32 )
- {
- DrawVec2 = sf::Vector2f(ColumnVector[j]->getPoint().x,RowVector[i]->getPoint().y);
- cout << " VEC2 SET" << endl;
- /*vec1set = false;*/
- vec2set = true;
- }
- }
- }
- if (vec1set == true && vec2set == true)
- {
- sf::Vector2f DrawVecDif = DrawVec2 - DrawVec1;
- cout << DrawVecDif.x << " " << DrawVecDif.y << " " << endl;
- for(GridRowVector::size_type i = 0; i < DrawVecDif.y; i ++)
- {
- for(GridColumnVector::size_type j = 0; j < DrawVecDif.x; j++)
- {
- mSprites.push_back(new Tile(mMouse.getTile(),mMouse.getId(),sf::Vector2f(DrawVec1.x + i*32, DrawVec1.y + j*32), Layer));
- /*cout << "square drawn" << endl;*/
- }
- }
- vec2set = false;
- vec1set = false;
- _ctrl = false;
- }
- }
Add Comment
Please, Sign In to add comment