Hi, i kinda found a way around my problem, but since all origin(I think) are suppose to be in top left corner I just dont get this one :
I was trying to draw rectangle (for menu button) from the bottom right of the window with this function :
Context :
int tailleFenetre[2] = {static_cast<int>(fenetre.getSize().x),static_cast<int>(fenetre.getSize().y)};
const int MAIN_MENU_SIZE = 4;
const int MENU_LARGEUR = 120, MENU_HAUTEUR = 40;
my function :
void buildMenu(int tailleFenetre[],string optionsMenu[],sf::Texture* ptrTexture){
sf::RectangleShape menuButton;
menuButton.setSize(sf::Vector2f(MENU_LARGEUR,(MENU_HAUTEUR-5)));
menuButton.setFillColor(sf::Color(221,133,175));
sf::RenderTexture texture1;
if(!texture1.create(tailleFenetre[0],tailleFenetre[1]))
for(int i = 0; i < MAIN_MENU_SIZE; i++){
menuButton.setPosition(sf::Vector2f((tailleFenetre[0]-MENU_LARGEUR-5),(tailleFenetre[1]-(MENU_HAUTEUR * i)-(MENU_HAUTEUR+5))));
texture1.draw(menuButton);
}
texture1.draw(menuButton);
*ptrTexture = texture1.getTexture();
}
I thought from that i should have gotten my rectangles in the bottom right corner but they drew on top right.
and if I replace my for loop with :
menuButton.setPosition(sf::Vector2f((tailleFenetre[0]-MENU_LARGEUR-5),5));
where menuButton.setPosition().y == 5; it draws the rectangle in bottom right.
I'm a bit confuse, can someone explain ?