Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - kazen

Pages: [1]
1
Graphics / Only negative coordinates are showing up in the window
« on: November 22, 2018, 12:48:27 am »
I am having a problem with drawing entities at positive coordinates.  The 0,0 coordinate draws correctly, but as the x and y setPosition/setOrigin/etc values increase the entity moves up and to the left.  I have to enter negative values for it to show up in the window.

Also, setOrigin is acting like setPosition and not centering the circle in the window, instead it is offset like the top left "corner" of the circle is in the middle of the window.


#include <iostream>
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>

int main()
{
        sf::RenderWindow window;
        window.create(sf::VideoMode(300,300),"!!!");
        sf::CircleShape circle(30);
        circle.setOrigin(-150,-150);    //This has to be negative to show up at (150,150)
        window.clear(sf::Color(100,100,100));
        window.draw(circle);
        window.display();
        std::cin.get();
}
 

Thanks

Pages: [1]
anything