Bonjour,
Je charge mes ressources via multi-thread, mais le Sprite est vide, rien s'affiche, pourtant je n'ai pas d'erreur lors du chargement...
Je ne comprend pas... voici le thread qui charge le code,et la fonction qui l'utilise (J'utilise le pattern Gamestate
)
void loadFiles (int &rtr)
{
thread_mutex.lock();
if(val.ld_bar_txt.loadFromFile(resourcePath()+"LC_LOAD.png")
&&
val.main_title_tex->loadFromFile(resourcePath() + "main_title.png")
)
{
tex=true;
}
// Musics
msc=true; // je n'ai rien à charger pour le moment
// If musics & Textures loaded Successfully :
if(msc && tex)
{
cout << "Sound :" << msc << endl << "Textures" << tex << endl;
cout << "Game ressources successfully loaded " << endl;
rtr=1;
}
// If not :
else
{
cout << "Sound :" << msc << endl << "Textures" << tex << endl;
cout << "Game will quit : [GRAVE] CANNOT LOAD MUSICS OR TEXTURES " << endl;
rtr=-1;
}
thread_mutex.unlock();
load_finish=true;
}
void CGmenu::Init()
{
if(!menu_music.openFromFile(resourcePath() + "PIXL_Rat_Twist.ogg"))
{
cout << "Error while loading music" << endl;
exit(-1);
}
//rsc->main_title_tex->loadFromFile(resourcePath() + "main_title.png");
main_title.setTexture(*rsc->main_title_tex);
main_title.setPosition(50,50);
// main_title.setScale(0.4,0.4);
menu_music.play();
menu_music.setVolume(70);
menu_music.setLoop(1);
cop.setString(L"© Pixel Box Inc 2014");
cop.setFont(Fonts.m_pixel7);
cop.setPosition(1000,665);
cop.setStyle(sf::Text::Italic);
cop.setColor(sf::Color::White);
cop.setCharacterSize(40);
play.setFont(Fonts.m_pixel7);
play.setPosition(125,175);
play.setStyle(sf::Text::Italic);
play.setColor(sf::Color::White);
play.setCharacterSize(60);
play.setString("_Play");
play_bound = play.getGlobalBounds();
cout << "Fonts are Okay" << endl;
}
Les 2 codes sont dans des classes différentes.
HELP