0
我使用SFML庫和Visual-C++創建條形圖。我想設置條形圖的起點,所以我嘗試使用move和setOrigin函數,但它不能成功。如何設置條形圖的起點
sf::RectangleShape rec1(sf::Vector2f(stage1x*1000, stage1y*1000));
sf::RectangleShape rec2(sf::Vector2f(stage2x*1000, stage2y*1000));
sf::RectangleShape rec3(sf::Vector2f(stage3x*1000, stage3y*1000));
rec1.setOrigin(0, 0);
rec2.setOrigin(0, 0);
rec3.setOrigin(0, 0);
rec1.move(200, 700); // This moves the Rectangle over 200 pixels and down 700 pixels
rec2.move(300, 700); // This moves the Rectangle over 300 pixels and down 700 pixels
rec3.move(400, 700); // This moves the Rectangle over 400 pixels and down 700 pixels
rec1.setFillColor(sf::Color(100, 250, 50));
rec2.setFillColor(sf::Color(10, 20, 100));
rec3.setFillColor(sf::Color(500, 600, 700));