Exemple #1
0
void CustomMenu::onEvent(const sf::Event& event) {
	Component* triggered = nullptr;

	while((triggered = popEvent(event))) {
		math::u_id id = triggered->getID();

		if(id == save->getID()) {

		} else if(id == load->getID()) {

		} else if(id == random->getID()) {
			conv << (Utility::Random::getUnsignedRandom()%1001);

			name_f->setText(SentenceGenerator::getWord(SentenceGenerator::Noun) +
					SentenceGenerator::getWord(SentenceGenerator::Noun));
			age_f->setText(conv.str());

			gender->randomize();
			//palette->randomize();

			conv.str("");
		} else if(id == back->getID())
			MenuUtils::mainMenu();
		else if(id == name_f->getID())
			name.setColor(name_f->getColor());
		else if(id == age_f->getID())
			age.setColor(age_f->getColor());
		else
			std::cerr << "Auto-destruction sequence activated. Nooooo!!!" << std::endl;
	}
}
Exemple #2
0
TextField::TextField( const TextField& def )
{
    setFontSize( def.getFontSize() );

    setColor(def.getColor());
    setBGColor(def.getBGColor());

    setFont( def.getFont() );
    setAlignment( def.getAlignment() );
    setFixedPitch( def.getFixedPitch() );
    setShadow( def.getShadow() );
}