So I am trying to make an application that requires multiple values to be considered. When EventA happens, I want Variable1 to be a certain X number. Then, if statements can check to see if X is the number for that certain if statement, and carry on with a specific order. I am not aware of how to do this exactly, so I tried to do it with strings:
#include <SFML/Graphics.hpp>
int main()
{
// Create the main window
sf::RenderWindow App(sf::VideoMode(800, 600), "Test");
sf::String Value1("1");
sf::String Text1("Value1 is active");
Text1.SetPosition(100.f, 100.f);
// Start the 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();
if (App.GetInput().IsKeyDown(sf::Key::Up)) Value1.SetText("2")
if (Value1.GetText() == "1") Text1.SetText("Value1 is active");
if (Value1.GetText() == "2") Text1.SetText("Value1 is inactive");
}
// Clear screen
App.Clear();
// Draw the string
App.Draw(Text1);
// Update the window
App.Display();
}
return EXIT_SUCCESS;
}
It doesnt work though. Any suggestions? Sorry if I havent been clear, I am not sure how to express what I want to do :cry: