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.
Thanks
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();
}
#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