Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Rodax

Pages: [1]
1
Graphics / Font issues
« on: November 11, 2011, 07:50:55 pm »
It seems to be crashing when the Atom constructor runs (if commented, it doesn't crash). The atom class has an sf::String member that is given a font reference to keep until it is drawn with a member function. The font itself is global already

2
Graphics / Font issues
« on: November 11, 2011, 06:52:18 pm »
Wow that's pretty interesting. Thanks. That fixed it for the thread, but now it completely crashes after it (the other posted code).

EDIT:: Doesn't crash anymore, however, now it only draws the font on the first frame. Never again.

3
Graphics / Font issues
« on: November 11, 2011, 05:53:00 am »
After a certain point in my program, nothing having to do with fonts will display. Is there something wrong with my code? I've changed it in all sorts of ways and nothing seems to solve the problem.

Code: [Select]
void Atom::Draw(sf::RenderWindow& Disp,sf::Font& Font,int x,int y)
{
    this->x = x;
    this->y = y;
    this->h = Bmp.GetRect().GetHeight();
    this->w = Bmp.GetRect().GetWidth();

    Bmp.SetText(Label.c_str());
    Bmp.SetFont(Font);
    Bmp.SetSize(28);
    Bmp.SetColor(CurrentColor);

    if (!Unstable)
    {
        Bmp.Move(x,y);
        Disp.Draw(Bmp);
    }


And here in a thread func.

Code: [Select]
void Loading(void* UserData)
{
    vector<sf::String> LoadingVector;

    sf::Color White;
    White.r = 255;
    White.g = 255;
    White.b = 255;
    White.a = 255;

    sf::String loads("Loading",sf::Font::GetDefaultFont(),48);
    sf::String loads1("Loading.",sf::Font::GetDefaultFont(),48);
    sf::String loads2("Loading..",sf::Font::GetDefaultFont(),48);
    sf::String loads3("Loading...",sf::Font::GetDefaultFont(),48);

    LoadingVector.push_back(loads);
    LoadingVector.push_back(loads1);
    LoadingVector.push_back(loads2);
    LoadingVector.push_back(loads3);

    for (unsigned int o=0;o<LoadingVector.size();o++)
    {
        LoadingVector[o].SetColor(White);
        LoadingVector[o].SetStyle(sf::String::Bold);
    }

    unsigned int i=0;

    long now = time(NULL);
    long then = now + 5;

    while(now < then)
    {
        UWin.Clear(sf::Color(70,255,100));

        int cx,cy;
        cx = (640 - LoadingVector[i].GetRect().GetWidth())/2;
        cy = (480 - LoadingVector[i].GetRect().GetHeight())/2;

        LoadingVector[i].Move(cx,cy);
        UWin.Draw(LoadingVector[i]);

        UWin.Display();
        Delay(400);

        i++;
        if (i > LoadingVector.size()-1)
            i = 0;

        time(&now);
    }

    LoadingVector.clear();

    UWin.Clear();
    UWin.Display();
}

Pages: [1]
anything