Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool GridFull = false;
- vec2set = false;
- if (RectangleTool == true && LeftMouseDown && Layer == 1)
- {
- _ctrl = true;
- /******************* Sets the first point of the Tile Fill Rectangle *******************/
- 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;
- }
- }
- }
- }
- /********************* Sets the second point of the Tile Fill rectangle ******************/
- if (vec1set = true && RectangleTool == true && LeftMouseDown) /*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;
- vec2set = true;
- Rect = sf::Shape::Rectangle(DrawVec1,DrawVec2,sf::Color(188,143,143,70), 3.0f,sf::Color(188,143,143,255) );
- }
- }
- }
- if (vec1set == true && vec2set == true)
- {
- for(GridRowVector::size_type i = 0; i < RowVector.size(); i ++)
- {
- for(GridColumnVector::size_type j = 0; j < ColumnVector.size(); j++)
- {
- if (ColumnVector[j]->getPoint().x >= DrawVec1.x &&
- ColumnVector[j]->getPoint().x+32 <= DrawVec2.x &&
- RowVector[i]->getPoint().y >= DrawVec1.y &&
- RowVector[i]->getPoint().y+32 <= DrawVec2.y)
- {
- sf::Vector2f FillVector = sf::Vector2f(ColumnVector[j]->getPoint().x,RowVector[i]->getPoint().y);
- for (SpriteVector::size_type k = 0; k < mSprites.size(); k++)
- {
- if ( fabs(ColumnVector[j]->getPoint().x - mSprites[k]->getTile().GetPosition().x) < 0.0001 && fabs(RowVector[i]->getPoint().y - mSprites[k]->getTile().GetPosition().y) < 0.0001)
- {
- GridFull = true;
- }
- if (GridFull == false)
- {
- mSprites.push_back(new Tile(mMouse.getTile(),mMouse.getId(),FillVector, Layer));
- /*cout << "square drawn" << endl;*/
- }
- }
- }
- vec1set = false;
- vec2set = false;
- }
- SettingSquare = false;
- }
- }
- }
Add Comment
Please, Sign In to add comment