well i want to draw a shape, and when a certain key is pressed i wanna rotate it 90°
how would this look like ?
do not laugh bout my tries ^^ :
while (App.IsOpened())
{
// Process events
/*
// Draw predefined shapes
App.Draw(Shape::Line(10, 10, 710, 100, 15, Color::Red));
App.Draw(Shape::Circle(200, 200, 100, sf::Color::Yellow, 10, sf::Color::Blue));
App.Draw(Shape::Rectangle(350, 200, 600, 350, sf::Color::Green));
*/
// Build a custom convex shape
Shape Polygon;
Polygon.AddPoint(0, -50, sf::Color(255, 0, 0), sf::Color(0, 128, 128));
Polygon.AddPoint(50, 0, sf::Color(255, 85, 85), sf::Color(0, 128, 128));
Polygon.AddPoint(50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
Polygon.AddPoint(0, 100, sf::Color(255, 255, 255), sf::Color(0, 128, 128));
Polygon.AddPoint(-50, 50, sf::Color(255, 170, 170), sf::Color(0, 128, 128));
Polygon.AddPoint(-50, 0, sf::Color(255, 85, 85), sf::Color(0, 128, 128));
// Define an outline width
Polygon.SetOutlineWidth(10);
// Disable filling and enable the outline
Polygon.EnableFill(true);
Polygon.EnableOutline(true);
// We can still use the functions common to all SFML drawable objects
Polygon.SetColor(Color(255, 255, 255, 255));
Polygon.Move(300, 300);
Polygon.Scale(3, 2);
// Polygon.Rotate(90);
// Draw it
App.Draw(Polygon);
// Finally, display the rendered frame on screen
App.Display();
Event Event;
while (App.GetEvent(Event))
{
// Close window : exit
if (Event.Type == Event.Closed)
App.Close();
if ((Event.Type == Event.KeyPressed) && (Event.Key.Code == Key::Escape))
{
App.SetActive();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Polygon.Rotate(90);
App.Draw(Polygon);
App.Display();
}
}
}