Hi, I'm trying to draw a star. A pentagon would be OK too, so that's what I'm working towards. I'm drawing 5 points at 72 degree intervals around the origin, then moving the shape to where you can see it. Unfortunately, it's not working. The angles aren't coming out right. What am I doing wrong?
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Graphics.hpp>
#include <math.h>
int main()
{
const int pi=3.141592654;
// Create main window
sf::RenderWindow App(sf::VideoMode(800, 600), "SFML Graphics");
// Start game loop
while (App.IsOpened())
{
// Process events
sf::Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
App.Close();
}
// Clear screen
App.Clear();
// Draw apredefined shape
//App.Draw(sf::Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue));
sf::Shape Star;
//Star.AddPoint((200*cos(((2*pi)/5))), (200*sin(((2*pi)/5))), sf::Color::Yellow, sf::Color::Red);
// Star.AddPoint((200*cos(((4*pi)/5))), (200*sin(((4*pi)/5))), sf::Color::Yellow, sf::Color::Blue);
// Star.AddPoint((200*cos(((6*pi)/5))), (200*sin(((6*pi)/5))), sf::Color::Yellow, sf::Color::Green);
// Star.AddPoint((200*cos(((8*pi)/5))), (200*sin(((8*pi)/5))), sf::Color::Yellow, sf::Color::Magenta);
// Star.AddPoint((200*cos(10*pi/5)), (200*sin(10*pi/5)), sf::Color::Yellow, sf::Color::White);
Star.AddPoint((200*cos(((2*pi)/5))), (200*sin(((2*pi)/5))), sf::Color::Yellow, sf::Color::Red);
//Star.AddPoint((200*cos(((4*pi)/5))), (200*sin(((4*pi)/5))), sf::Color::Yellow, sf::Color::Blue);
Star.AddPoint((200*cos(((6*pi)/5))), (200*sin(((6*pi)/5))), sf::Color::Yellow, sf::Color::Green);
//Star.AddPoint((200*cos(((8*pi)/5))), (200*sin(((8*pi)/5))), sf::Color::Yellow, sf::Color::Magenta);
Star.AddPoint((200*cos(10*pi/5)), (200*sin(10*pi/5)), sf::Color::Yellow, sf::Color::White);
Star.AddPoint((200*cos(((4*pi)/5))), (200*sin(((4*pi)/5))), sf::Color::Yellow, sf::Color::Blue);
Star.AddPoint((200*cos(((8*pi)/5))), (200*sin(((8*pi)/5))), sf::Color::Yellow, sf::Color::Magenta);
Star.Move(300, 300);
Star.EnableFill(true);
Star.EnableOutline(true);
Star.SetOutlineWidth(25);
App.Draw(Star);
// Finally, display the rendered frame on screen
App.Display();
}
return EXIT_SUCCESS;
}