[SOLVED] How to cache .gif files using QLabel & QMovie ?
-
Hi, I am working on some sort of Tower Defense Game
It's working great except minors things.Image:
http://s1.directupload.net/images/121227/7ehj2iwu.jpg
http://img4.imageshack.us/img4/9991/gameinfox.jpgNow I try to increase the monster spawning amount.
But already with a number of 40 it starts to lag too much.
So I need to cache the one monster.gifI am using simply a QLabel and a QMovie to display them
@ //MONSTER
QLabel *monster[400];
QMovie *monster_movie[400];@@ for (int i=0; i<3; i++) {
// Monster [X]
monster[i]= new QLabel(widget_map_background);
monster[i]->setStyleSheet("background-image: url( )" );monster_movie[i] = new QMovie("monsters/SlugGunner_walk.gif");
monster[i]->setMovie(monster_movie[i]);
monster[i]->resize(60,60);
monster[i]->setScaledContents(true);
monster_movie[i]->start();
}@How can I do this?
thanks for any help! -
LOOOOOOOOOOOOOOOOOOL
Okay guys, you will never guess what caused the big performance issue.
somewhere I placed accidentally the code
@repaint();@
and that caused so big performance issues O.O
so no need for cache anything.holy pussycat^^