Beispiel #1
0
void KeyboardMenu::set_string_position(sf::String &string, int v_pos, int screen_width)
{
	if( default_hpos == HorizontalPositions::LEFT )
	{
		string.SetPosition(10, v_pos);
	}
	else
	{
		string.SetPosition(screen_width - string.GetRect().GetWidth() - 10, v_pos);
	}
}
Beispiel #2
0
void Param::lire_Texte(std::ifstream &fichier, sf::String &destination, sf::Font &myFont)
{
    std::string ligne;
    int x, y, z;
    lire_string(fichier, ligne);
    destination.SetText(traduire(ligne.c_str()));
    lire_position(fichier, x, y);
    destination.SetPosition(x, y);
    lire_string(fichier, ligne);
    if(ligne != "default" && !myFont.LoadFromFile(ligne))
    {
        std::cerr << "Erreur lors du chargement de la police '" << ligne << "'" << std::endl;
        myFont = sf::Font::GetDefaultFont();
    }
    else if(ligne == "default")
        myFont = sf::Font::GetDefaultFont();
    lire_int(fichier, x);
    destination.SetSize(x);
    lire_string(fichier, ligne);
    set_police(destination, ligne.c_str());
    lire_couleur(fichier, x, y, z);
    destination.SetColor(sf::Color(x, y, z));
    lire_int(fichier, x);
    destination.SetRotation(x);
}
Beispiel #3
0
int log_setup_1(){
	//Load Font
	if( PTSANS_loaded == false ){
		if (!PTSANS.LoadFromFile("PTN57F.ttf", 50)) return -1;
		PTSANS_loaded = true;
	}

	//Setup Strings
	log_string.SetFont( PTSANS );
	log_string.SetSize(24.f);
	log_string.SetColor( sf::Color(255, 255, 255) );
	log_string.SetPosition(100.f, 600.f);

	log_name.SetFont( PTSANS );
	log_name.SetSize(40.f);
	log_name.SetColor( sf::Color(255, 255, 255) );
	log_name.SetPosition(100.f, 550.f);
}
Beispiel #4
0
    void    InfoBox::draw(sf::RenderWindow& rw)
    {
        glColor3f(0.6, 0.6, 0.6);
        drawRectangle(start_, end_, true);

        static sf::String tx;
        tx.SetText("Status");
        tx.SetFont(sf::Font::GetDefaultFont());
        tx.SetStyle(sf::String::Bold);
        tx.SetPosition(start_[0] + 20, start_[1] + 20);
        tx.SetSize(16);
        rw.Draw(tx);
    }
Beispiel #5
0
void SubWindow::add(sf::String text, sf::Vector2i pos) {
	text.SetPosition(pos.x + position.x, pos.y + position.y);

	queue.push_back(new sf::String(text));
}