class C_ImageSet { public: int FrameWidth, FrameHeight; // Dimensions of ImageSet in pixels. int nLoops; // Number of Loops (0 = infinite) C_Image ** img; // Images' Vector. int nImages; // Number of images (vector size) void AddImage (C_Image*); // Append new image to vector (push_back) void kill(); // detruit // constructor and destructor: C_ImageSet() {img=0; nImages=0; nLoops=0;} ~C_ImageSet() {for (int n=0;n<nImages;n++) delete img[n]; delete[] img;} // File Formats: int LoadGIF (char* szFile); int SaveGIF (char* szFile) {return 0;}; // NOT IMPLEMENTED }; #define DEFAULT_CLASSNAME "AnimationWindow" class C_AnimationWindow { protected: HANDLE hThreadAnim; // Thread Handle DWORD dwThreadIdAnim; // Thread Identifier public: HWND m_hWnd; // Window Handle C_ImageSet * pAnimation; // Pointer to Animation Raster Information int CurrentImage; // Current Image being displayed int CurrentLoop; // Current Loop in animation BOOL bAnimationPlaying; // TRUE when animation is playing. // CLASS FUNCTIONS: (not object functions!) static LRESULT CALLBACK WndProc (HWND hwnd,UINT iMsg,WPARAM wParam,LPARAM lParam); static DWORD WINAPI fnThread (LPVOID lpParameter); // Animation control: void Play(); // Starts/Resumes animation void Stop(); // Stops(Pauses) animation (without rewinding) void Rewind(); // Rewinds animation (without stopping) // Paints current image of animation: void Paint (HDC hdc); // WIN32 WRAPPING FUNCTIONS: // Create a new Window (initially hidden, call Display to display): HWND Create (HWND hwndParent, HMENU id, C_ImageSet * imageset, DWORD dwStyle=WS_CHILD, char* szClassName=DEFAULT_CLASSNAME); // Display Window at specified location (x&y= upper-left corner) BOOL Display (int x, int y); // You may redefine the following windows' message processing function // in a derived class to implement a different behavior: virtual LRESULT Message (UINT iMsg,WPARAM wParam, LPARAM lParam); };
struct Element { C_AnimationWindow gif; C_ImageSet imgset; Element* suivant; }; void Ajouter(char *fichier,int x,int y,HWND hwnd) { Element* element= new Element; element->imgset.LoadGIF(fichier); element->gif.Create(hwnd,NULL,&element->imgset); element->gif.Display(x,y); element->suivant = liste; liste = element; } void Netoyemem(HWND m_hWnd) { Element* element = liste; while(element != NULL && element->gif.m_hWnd != m_hWnd) element = element->suivant; if (element != NULL) Supprimer(element); }
void Netoyemem(HWND); LRESULT C_AnimationWindow::Message (UINT iMsg,WPARAM wParam, LPARAM lParam) { HDC hdc; PAINTSTRUCT ps; switch (iMsg) { [....] case WM_DESTROY: Stop(); Netoyemem(m_hWnd); return 0; } return DefWindowProc (m_hWnd,iMsg,wParam,lParam); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionC_AnimationWindow gif; C_ImageSet imgset; int __stdcall AffGif(HWND mWnd,HWND,char *data,char*,BOOL,BOOL) { //reset de gif et imgset delete gif delete imgset; //initialisation de gif et imgset //fonction }