This worked great so I decided to use it in an IF statement (enclosed).
It compiles but is ignored in execution.
What am I doing wrong please?
Warren
#include <SFML/Graphics.hpp>
int main()
{
int x = 150, y = 450, random = 5;
// Create main window
sf::RenderWindow App(sf::VideoMode(1400, 900), "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();
//Escape key exit
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Escape))
App.Close();
//F1 key pressed
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::F1))
App.Close();
}
// Clear screen
App.Clear(sf::Color(128, 128, 128));
sf::Color grn(0,255,0);
if(random == 5)
{
sf::Color grn(255,215,0);
}
App.Draw(sf::Shape::Circle(x,y,50,sf::Color(grn)));
// Finally, display the rendered frame on screen
App.Display();
}
return EXIT_SUCCESS;
}