Here is what i tried:
#include <iostream>
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <SFML/System.hpp>
#include <sstream>
using namespace std;
int main()
{
sf::RenderWindow App(sf::VideoMode(400,100,16), "Calculator - By: DarK_DemoN");
sf::Font MyFont;
if (!MyFont.LoadFromFile("Fonts\\AdamFont.ttf"))
return EXIT_FAILURE;
int a;
int b;
int c;
std::stringstream stream;
sf::String Output("Please enter a number: ");
sf::String InputStr;
while (App.IsOpened())
{
sf::Event Event;
while (App.GetEvent(Event))
{
const sf::Input& Input = App.GetInput();
if (Event.Type ==sf::Event::Closed )
App.Close();
if (Input.IsKeyDown(sf::Key::Escape))
App.Close();
if (Event.Type == sf::Event::TextEntered)
{
if (Event.Text.Unicode < 256)
{
a += static_cast<char>(Event.Text.Unicode);
stream << a;
}
}
InputStr.SetText(stream.str());
}
}
App.Draw(Output);
App.Draw(InputStr);
App.Display();
}
return 0;
}
It doesnt produce any errors but it is VERY unstable. When the window appears after compiling i cant enter in any numbers and after a couple of seconds it stops responding. Its either it does that or right after its done compiling i get a see-through window (no BG color, no text, nothing).
Please help