3
« 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.
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.
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();
}