I am using the multiple screens source from the wiki and CPGUI. No matter what I do I cannot get the input box or buttons to be active. It seems that the multiple screens break CPGUI. Does anybody else have this issue?
#include "loginscreen.h"
int LoginScreen::Run(sf::RenderWindow &App)
{
cp::cpGuiContainer GUI;
sf::Event Event;
sf::Image Image;
sf::Sprite Sprite;
sf::Music Music;
if(!Music.OpenFromFile("1.wav"))
{
return (-1);
}
if(!Image.LoadFromFile("mainmenu.png"))
{
return (-1);
}
Music.SetLoop(true);
Music.Play();
Sprite.SetImage(Image);
sf::String UsernameInputString("Username:", sf::Font::GetDefaultFont(), 20);
UsernameInputString.SetPosition(150, 200);
UsernameInputString.SetColor(sf::Color::White);
cp::cpTextInputBox UsernameInputBox(&App, &GUI, "", 250, 200, 230, 25);
sf::String PasswordInputString("Password:", sf::Font::GetDefaultFont(), 20);
PasswordInputString.SetPosition(150, 250);
PasswordInputString.SetColor(sf::Color::White);
cp::cpTextInputBox PasswordInputBox(&App, &GUI, "", 250, 250, 230, 25);
cp::cpButton LoginButton(&App, &GUI, "Login", 250, 300, 70, 30);
cp::cpButton RegisterButton(&App, &GUI, "Register", 350, 300, 90, 30);
const sf::Input& input = App.GetInput();
while(true)
{
while (App.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
{
return (-1);
}
UsernameInputBox.ProcessTextInput(&Event);
PasswordInputBox.ProcessTextInput(&Event);
GUI.ProcessKeys(&Event);
}
App.Clear();
App.Draw(Sprite);
App.Draw(UsernameInputString);
UsernameInputBox.Draw();
App.Draw(PasswordInputString);
PasswordInputBox.Draw();
LoginButton.Draw();
RegisterButton.Draw();
App.Display();
}
return (-1);
}