Problème SDL_APPMOUSEFOCUS

Fermé
Rack - 7 avril 2014 à 14:47
Bonjour,

lorsque je perd, ou gagne le focus, rien ne se passe

#include <stdio.h>
#include <stdlib.h>
#include <SDL/SDL.h>
#include <SDL/SDL_image.h>
 
 
 
int main(int argc, char *argv[])
{
    SDL_Surface *ecran = NULL, *zozor = NULL;
    SDL_Rect positionZozor;
    SDL_Event event;
    int continuer = 1;
    SDL_Init(SDL_INIT_VIDEO);
    ecran = SDL_SetVideoMode(640, 480, 32, SDL_HWSURFACE);
    SDL_WM_SetCaption("Gestion des événements en SDL", NULL);
    /* Chargement de Zozor */
    zozor = SDL_LoadBMP("zozor.bmp");
    SDL_SetColorKey(zozor, SDL_SRCCOLORKEY, SDL_MapRGB(zozor->format, 0, 0, 255));
    /* On centre Zozor à l'écran */
    positionZozor.x = ecran->w / 2 - zozor->w / 2;
    positionZozor.y = ecran->h / 2 - zozor->h / 2;
 
    SDL_EnableKeyRepeat(10,10);
 
    while (continuer)
    {
        SDL_PollEvent(&event);
        switch(event.type)
        {
                   switch(event.active.state){
                     if((event.active.state & SDL_APPMOUSEFOCUS)==SDL_APPMOUSEFOCUS){
 
            if (event.active.gain==1)
            positionZozor.x-50;
        else if (event.active.gain==0)
                positionZozor.x+50;
 
 
 
                     }
 
                   }
            }
SDL_FillRect(ecran, NULL, SDL_MapRGB(ecran->format, 255, 255, 255));
        /* On place Zozor à sa nouvelle position */
        SDL_BlitSurface(zozor, NULL, ecran, &positionZozor);
        /* On met à jour l'affichage */
        SDL_Flip(ecran);
 
 
        }
 
        /* On efface l'écran */
 
 
 
    SDL_FreeSurface(zozor);
    SDL_Quit();
    return EXIT_SUCCESS;
 
 
    }