1
Graphics / Pentagon not being quite right?
« on: March 29, 2011, 02:52:40 am »
/facepalm. I can't believe I was that stupid... It works now, thanks!
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.
////////////////////////////////////////////////////////////
// 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;
}